Questions on High pass filter and Padding in Preprocessing

gao zai zaifengg at GMAIL.COM
Fri Mar 12 11:07:48 CET 2010

Dear all,

I am now working on the MEG data in 4D format. Since it was collected in DC,
so I want to first use a bandpass filter [0.1 80] to filter my data.
However, I found that the latter part of averaged results drifted away
relative to the  results when no filter or only a low-pass filter is used
(see the attached Fig.1). I thought it may be related to the end effect, so
I used cfg.padding=1, it didn't work. Latter I turned to use cfg.padding=10
(1/.1=10) it works and no obvious drift was found.

However, when tried to only apply a high pass filter to the raw data,
regardless of using cfg.padding=10, the results always showed a square wave
(see Fig.2). And there is a warning:"Matrix is close to singular or badly
scaled. Results may be inaccurate. RCOND = 6.669292e-17."I don't understand
why this happened. Does anybody know what is the problem with it? How can I
get a right result in this case? Thank you very much.

The script I used:
cfg.dataset ='c,rfDC';
cfg.trialdef.eventtype  = 'TRIGGER';
cfg.trialdef.eventvalue =42;
cfg.trialdef.prestim    = 1;
cfg.trialdef.poststim   = 1.5;
cfg.trialdef.offset     = 1;
cfg.trialfun            = 'mytrialfun';
cfg = definetrial(cfg);

%for band pass
%cfg.bpfreq=[0.1 80];


%for hp filter
cfg.hpfilter='yes';    %high pass filter
cfg.hpfreq=0.1;         %cutoff

cfg.blc = 'yes'; %baseline correct
cfg.blcwindow  = [-0.30 -0.10];{'MEG'};
[data] = preprocessing(cfg);


The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fig1.png
Type: image/png
Size: 11637 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fig.2_square wave.png
Type: image/png
Size: 1041 bytes
Desc: not available
URL: <>

More information about the fieldtrip mailing list