[Eeglablist] Problem with filtering 300 sample trial

Andreas Widmann widmann at uni-leipzig.de
Wed Mar 26 04:21:43 PDT 2014

Hi David,

> I'm currently struggling with the eegfilt function. I have following trial which I want to low pass filter:
> I filter it using following command
> newTrial = eegfilt(trial, 500, 0, 10, 0, 16, 0);
(1) Do not use eegfilt. It is deprecated and gives suboptimal results.

I would recommend using the firfilt-plugin functions:
>> b = firws(16, 10 / (500 / 2));
>> newtrial = firfiltdcpadded(b, trial', 0)’;

Please note, that filter order 16 is far to low to give you a -6dB cutoff at 10Hz.

> Also, if I compare the mean standard deviation of  mean(std(trial)) and mean(std(newTrial)) I get 8.97283262607351 and 3.52360238407558 respectively. The trial actually loses energy. Is there a way to counteract this energy removal?
(2a) You should compute std along time dimension.
(2b) Filtering is attenuation of frequency bands. So, I would be irritated if you would have found something different. The effect is indeed extreme in your case due to (1). Have a look at eegfilt's frequency response:

>> [newTrial, filtwts] = eegfilt(trial, 500, 0, 10, 0, 16, 0);
>> freqz(filtwts, 1, [], 500)

The eegfilt filter will attenuate the signal across the whole spectrum.

Hope this helps. Best,

More information about the eeglablist mailing list