[Eeglablist] anti-aliasing with downsampling?
Li, Lucia M
lucia.li at imperial.ac.uk
Thu Nov 5 06:07:11 PST 2015
Thank you for your help.
- I am using EEGLAB 13.4.4b with Matlab R2014a
- These are my spectopo options:
figure; pop_spectopo(EEG, 1, [0 403736], 'EEG' , 'freqrange',[1 40],'electrodes','off');
- By "introduce many/extra frequencies", I mean e.g. between 30-40Hz, there are several peaks in the final plot (after downsampling), which aren't evident in either of the first two plots.
Images are found: http://postimg.org/image/97w6davr1/
1st one is high pass filtered (still sampled at 5000Hz) at 0.5Hz.
2nd is low pass filtered (on top of the high pass filtering) at 70Hz.
3rd one is after downsampling to 250Hz
Plots done as per your recommendation.
There is a little residual signal >70Hz after filtering - does that imply that the filtering hasn't completely worked?
I note that there do not seem to be in extra frequencies in the plots after downsampling - does that mean the pop_spectopo function plots applies a different function than pwelch?
Many thanks again for your advice.
From: Andreas Widmann [widmann at uni-leipzig.de]
Sent: Monday, November 02, 2015 11:02 AM
To: Li, Lucia M
Cc: eeglablist at sccn.ucsd.edu
Subject: Re: [Eeglablist] anti-aliasing with downsampling?
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“.
(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.
> 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,
> 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