[Eeglablist] anti-aliasing with downsampling?

Andreas Widmann widmann at uni-leipzig.de
Mon Nov 2 03:02:47 PST 2015

Hi Lucia,

the effects of 40Hz lowpass filtering do not look right/as expected, so I would like to have a look into the issue. Several questions have to be addressed first.

* Please (always) state EEGLAB version. There have been substantial changes in the resampling function recently and it might be relevant whether you use the old or the new code.
* Please all all spectopo options you used to make the plot (optimally command line version from eegh).
* Please explain what you mean by „introduce many frequencies“/„extra frequencies“.

Preliminary comments:
(a) spectopo unfortunately uses a fixed length fft (1024). Thus, frequency axis sampling depends on sampling rate. With 5000 Hz you get a frequency sampling point every 4.9 Hz (5000/1024); with 250 Hz you get a frequency sampling point every 0.24 Hz. So, in your Figure 6 the frequency axis is sampled 20 times higher. I case you mean with „extra frequencies“ that you see more details, this is most likely due to the higher frequency axis sampling. (I will try to have a look into the spectopo code in the next weeks to see how difficult it would be to introduce a fft length option).
(b) The (MATLAB implementation of the) pwelch method used in spectopo is susceptible to frequency noise/rounding errors introduced by DC offsets. You might want to try to apply a highpass filter before frequency analysis.
(c) The 40 lowpass filter appears to have no/little effect. I would like to sort out (a) and (b) before looking into this.

Please highpass filter you raw dataset (e.g. 0.1 Hz) and upload the following plots:
figure, pwelch(EEG.data', [], [], 10240, 5000); xlim([0 0.07]) % or xlim([0 70]) in case the frequency axis is automatically scaled to Hz instead of kHz
and the same figure after lowpass filtering and
figure, pwelch(EEG.data', [], [], 512, 250); xlim([0 70])
after downsampling to 250 Hz.


> Am 30.10.2015 um 12:05 schrieb Li, Lucia M <lucia.li at imperial.ac.uk>:
> Dear EEGlab users & experts,
> I was hoping someone might be able to shed some light how why downsampling my data appears to introduce many frequencies into it.
> http://s8.postimg.org/ah6vqvaut/Screen_Shot_2015_10_30_at_10_59_35.png
> I have acquired some EEG data at 5000Hz (figure 2). I acquired this with Brain Products and exported the data without doing anything to it, to use in eeglab.
> I then lowpass filtered it at 40Hz in eeglab (using the Tools --> filter data --> basic FIR filter (new, default)) (figure 5).
> I then downsampled it to 250Hz (Tools --> change sampling rate) and get the resultant spectral plot (figure 6). 
> I was wondering:
> a) are these extra frequencies indicative of anti-aliasing? If not, what might they indicate?
> b) why am I still getting anti-aliasing effects if I downsampled after a low pass filter?
> Many thanks in advance for your help!
> Kind regards,
> Lucia
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu

More information about the eeglablist mailing list