[Eeglablist] Zero-phase filters in EEGLAB

Andreas Widmann widmann at uni-leipzig.de
Mon May 25 03:38:11 PDT 2020


Hi Eric,

> I'm sorry to bother you with this but as far as I know, the following code also implements a zero-phase filter: 
> 
> dev = 0.001; df = 2;
> 
> beta = pop_kaiserbeta(dev);
> m = pop_firwsord('kaiser', EEG.srate, df, dev);
> 
> [EEG, com, b] = pop_firws(EEG, 'fcutoff', [1 70], 'ftype', 'bandpass', 'wtype', 'kaiser', 'warg', beta, 'forder', m);
> 
> Is this correct?
Yes, this is a zero-phase filter and the code looks perfectly correct (but did not test).

> And do you have any recommendations for the filter order?
The main parameter for order is transition bandwidth, „df" in your above code (and you correctly computed order from there in your above code). The transition band is cutoff +/- df/2 (for FIR). That is, for your df = 2 (Hz) highpass filter part the stopband is just 0 Hz/DC and the passband starts at 2 Hz. For the lowpass filter part the passband ends at 69 Hz and the stopband starts at 71 Hz.

If you need a highpass filter attenuating low frequencies in a wider stopband (e.g. for ICA preprocessing) you might want to use a narrower transition band, e.g. df = 1. You then get a stopband from 0-0.5 Hz and a passband starting at 1.5 Hz (with 1 Hz cutoff as above).

For these sharp filters I typically recommend separating highpass and lowpass parts. There are no drawbacks except computation time. You may then use a sharp, high order highpass and a shallow, low order lowpass.

Note, that „cutoff“ is defined differently in pop_eegfiltnew and pop_firws. pop_eegfiltnew actually defines the passband edges rather than true cutoff. That is, transition band is passband edge +/- transiition bandwidth/df. pop_firws uses canonical half-amplitude cutoff as given in textbooks. pop_eegfiltnew syntax was based on deprecated pop_eegfilt and EEGLAB developers wanted to keep backward compatibility.

Does this help? Best,
Andreas

> Best,
> 
> Eric
> 
> On Tue, May 12, 2020 at 9:58 AM Andreas Widmann <widmann at uni-leipzig.de> wrote:
> Hi Eric,
> 
> > I'm trying to use a zero-phase filter in EEGLAB.
> > 
> > Does anyone have any recommendations? Is pop_eegfiltnew a zero-phase
> > filter?
> Yes, pop_eegfiltnew implements a zero-phase filter (as long as you don't check the minimum-phase causal checkbox or use the corresponding minphase command line option). Also windowed-sinc FIR (pop_firws) and Parks-McClellan FIR filters (pop_firpm) all implement zero-phase filters.
> 
> Best,
> Andreas




More information about the eeglablist mailing list