[Eeglablist] causal bandpassfilter with very low cutoff

Andreas Widmann widmann at uni-leipzig.de
Mon Aug 6 09:38:46 PDT 2012


Hi Sophie,

a 0.01 Hz highpass filter with 512 Hz sampling frequency is very extreme. My personal rule of thumb is that the srate / cutoff ratio for IIR highpass filtering should not be much higher than ~1000 (acknowledgement to BM). The problem is increased by the EEGLAB default estimation of required filter order by a very narrow transition band (defined as cutoff/3 in your case; the help text in pop_iirfilt is wrong!). The extreme filter cutoff with narrow transition band requires a high filter order (here 6), but the resulting 6th order filter is instable.

I would suggest first downsampling the data to an as low as possible sampling frequency (after lowpass filtering the data to 1/4-1/5 of new sampling frequency!).

Then, I would suggest filtering the data with a butterworth filter at 0.1 Hz cutoff frequency. Roll-off is a function of filter order (approx. order times -6dB/octave).
E.g.:
>> [b, a] = butter(4, 0.1 / (srate / 2), 'high')
for a forth order filter.

Check frequency response with
>> freqz(b, a, 2^14, srate)
At 256 Hertz this gives a reasonable frequency response and very good DC attenuation. Downsampling your data to 128 Hz you can use the same filter for a 0.05 Hz highpass.

Check filter stability with
>> zplane(b, a)
All poles should be inside the unit circle. If you test the 6th order butterworth filter you will see that also this filter is instable.

Causal filtering can be done easily on the command line using the MATLAB built in filter function. Take care not to filter across boundaries/DC offsets! Filter each segment separately.

Hope this helps, best,
Andreas

Am 06.08.2012 um 17:44 schrieb Sophie Herbst <ksherbst at googlemail.com>:

> Hi EEGlablist,
> 
> I am trying to apply a causal bandpass filter with a very low cutoff (0.01Hz) to my EEG data (continuos data with ~2,700,000 points, srate = 512Hz)
> by using iirfilt.m:
> 
> iirfilt(EEG.data, EEG.srate, 0.01, 40, 0, 0, 0, [], [], 'on')
> 
> I seem to run into similar problems as described in EEGLAB Bug #1011: the default values for transition bandwidth and passband/ stopband ripple do not seem to work as
> the filter runs but leaves a matrix of NaNs. 
> 
> I have been playing around with values for the transition bandwidth etc, but I could not get a satisfying frequency response. 
> Any idea why this is and which filter would be better to use?
> 
> Thanks a lot,
> Sophie




More information about the eeglablist mailing list