[FieldTrip] [Fieldtrip] Line noise Removal

Alessandro Orticoni alessandro.orticoni at gmail.com
Thu Jun 28 17:22:03 CEST 2018


Dear experts,

I'm basically a beginner in coding with Fieldtrip, and I'm having a problem
with line noise filtering.
I would like to remove it from the heart rate signal, and I tried just
typing 'yes' at the option cfg.dftfilter.
But is doesn't seem to work, since the power spectrum contains the 50Hz and
her harmonics even after the filtering.

You can find the code in the following lines:

%% ===FREQUENCY Pre Filtering VERIFICATION===
fs=data.fsample;

cfg = [];
cfg.output        = 'pow';
cfg.channel       = 'ECG 2';
cfg.method        = 'mtmfft';
cfg.taper         = 'hanning';
cfg.pad           = 'nextpow2';
cfg.foilim        = [0.3 fs/2]; % teorema di Nyquist
freq_epoched_Cz   = ft_freqanalysis(cfg, data_epoched_Cz);

%% ===Plot Spectra===
figure;
plot(freq_epoched_Cz.freq,mag2db(freq_epoched_Cz.powspctrm));

%% ===Filtering===
cfg            = [];
cfg.channel    = {'ECG 2'};
cfg.dftfilter  = 'yes';
ECG_Filtered   = ft_preprocessing(cfg,data_Cz);

cfg          = [];
cfg.length   = 30; % in seconds;
cfg.overlap  = 0;
data_epoched_ECG_Filtered = ft_redefinetrial(cfg, ECG_Filtered);

cfg = [];
cfg.output        = 'pow';
cfg.method        = 'mtmfft';
cfg.taper         = 'hanning';
cfg.pad           = 'nextpow2';
cfg.foilim        = [0.3 fs/2]; % teorema di Nyquist
freq_epoched_Cz_Filtered = ft_freqanalysis(cfg, data_epoched_ECG_Filtered);

%% ===Plot Spectra===
plot(freq_epoched_Cz_Filtered.freq,mag2db(freq_epoched_Cz_Filtered.powspctrm));

Thanks a lot.

Kind regards,
Alessandro Orticoni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180628/fda2f668/attachment-0001.html>


More information about the fieldtrip mailing list