Filter ERPs for Display

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Tue Jan 3 17:21:21 CET 2006

Dear Markus,

On 3-jan-2006, at 16:00, Markus Werkle-Bergner wrote:
> I would like to use a filter before displaying ERPs with fieldtrip.
> Is there a possibility to just apply a lp-filter to averaged ERP,
> without going back to preprocessing?

Yes, you can use an undocumented option of TIMELOCKANALYSIS, or
actually two: First, the timelockanalysis function is designed for
raw data (from preprocessing) but will also accept the output of
timelockanalysis as its input (instead of raw). And second,
timelockanalysis has the same options for filtering as preprocessing

So you should be able to do something like

cfg = []
cfg = ...
raw = preprocessing(cfg)

cfg = []
avg = timelockanalysis(cfg)
figure; plot(avg.time, avg.avg, 'r');

cfg = []
cfg.lpfilter = 'yes'
cfg.lpfreq = 30
avg_filt = timelockanalysis(cfg)
hold on; plot(avg_filt.time, avg_filt.avg, 'b');

and then you should get a figure with the filtered and unfiltered
data plotted over each other.


PS the reason sofar for keeping it as an undocumented feature is that
we prefer people to do the filtering on the raw data, and use
filterpadding (i.e. read some extra data on both sides, apply the
filter and then throw away the signal at the edges). This is
implemented in preprocessing where the continuous data is available
from the original file, but this type of padding can of course not be
done any more on the ERP.

More information about the fieldtrip mailing list