[Eeglablist] Problem with eegfilt()

Andreas Widmann widmann at uni-leipzig.de
Mon Jan 25 00:32:52 PST 2016


eegfilt is known to be problematic/broken since many years.
https://sccn.ucsd.edu/bugzilla/show_bug.cgi?id=631

Do *NOT* use it (neither the firls nor the fir1 version; „Basic FIR filter (legacy)“ in GUI) except for backward compatibility purposes (the replication of old analyses and similar purposes)! Both may give unexpected results. The problem you noticed (non-unity DC gain) and others were described here:
http://journal.frontiersin.org/article/10.3389/fpsyg.2012.00233/full

Use pop_eegfiltnew („Basic FIR filter (new, default)“ in GUI) instead.

Best,
Andreas

> Am 24.01.2016 um 06:53 schrieb Uri Maoz <uri_maoz at hotmail.com>:
> 
> Hello EEGLab users,
> The filter that eegfilt() creates with its default parameters seems to sometimes introduce a drift into the data. To see this, run the following Matlab code:
> t=0:.001:2; x=[zeros(size(t(t<1))),ones(size(t(t>=1)))]; figure; plot(t,x,'.-'); y=eegfilt(x,1000,0,10); hold on; plot(t,y,'.-'); legend('original data','filtered data');
> This creates a step function and then filters it. As you can see, the filter introduces a shift in the value of the data when tracking the non-zero part of the step function. Another way to see how the filtered data drifts away from the original signal is this code:
> t=0:.001:2; x=t.^2+sin(2*pi*5.*t)+randn(size(t)).*0.1; figure; plot(t,x,'.-'); y=eegfilt(x,1000,0,10); hold on; plot(t,y,'.-'); legend('original data','filtered data');
> In the latest EEGLab version, the developers note that using the default fir-filter type, firls, to estimate figure parameters is problematic. Therefore, do not use the default firls; use fir1 instead. Indeed, if you try the code below with fir1, there will be no drift:
> t=0:.001:2; x=[zeros(size(t(t<1))),ones(size(t(t>=1)))]; figure; plot(t,x,'.-'); y=eegfilt(x,1000,0,10,0,0,0,'fir1'); hold on; plot(t,y,'.-');
> t=0:.001:2; x=t.^2+sin(2*pi*5*t)+randn(size(t)).*0.1; figure; plot(t,x,'.-'); y=eegfilt(x,1000,0,10,0,0,0,'fir1'); hold on; plot(t,y,'.-');
> Best wishes,
> Uri Maoz
> _______________________________________________
> 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