ECG spectrum wrong?
Show older comments
Hi all,
I have a question about an EKG spectrum.
Someone gave me this ECG spectrum for an exercise.
I'm not sure but the spectrum looks weird.
You clearly see a 50 Hz tone and its harmonics.
The whole thing looks like a modulation.
I would say there was no anti aliasing filter used.
Or does an ECG spectrum with 50 Hz + harmonics look like that?
Thanks for the help.
Best Regards.
Accepted Answer
More Answers (3)
Daniel M
on 29 Oct 2019
I'm not sure how you're doing your notch filters, but try this:
Fs = 625; % or whatever your sampling frequency is.
Fn = Fs/2; % Nyquist frequency
numHarmonics = 4; % Let's do 50, 100, 150, 200, 250
lineFreq = 50; % Hz
for fq = ((0:numHarmonics)+1) * lineFreq
Fl = fq + [-1, 1]; % notch around Fl. Could try [-2, 2] if too tight
[z,p,k] = butter(6, Fl/Fn, 'stop');
sos = zp2sos(z,p,k);
data = filtfilt(sos, 1, data); % assumes data is [time x ... dimensions]
% overwrites data, and filters sequentially for each notch
end
1 Comment
Stephan Lallinger
on 1 Nov 2019
Stephan Lallinger
on 29 Oct 2019
0 votes
Stephan Lallinger
on 1 Nov 2019
4 Comments
You may want to post this as a new question so more people can see it. But I have a few comments.
For your bandpass filter, try this
data = detrend(data); % remove the mean
[B, A] = butter(4, [0.5/(fs/2) 150/(fs/2)]);
filt_data = filtfilt(B,A,data);
As for notch filters, I either use the code I posted above, or the function ft_preproc_dftfilter() in the Fieldtrip toolbox. (It uses a similar approach to yours, which I'm not familiar with, so your issue could be something small.)
But your issue might be aliasing. What is your sampling frequency? If it is under 300, that could cause an issue with filter at 150 Hz.
Stephan Lallinger
on 2 Nov 2019
Daniel M
on 2 Nov 2019
Ok good idea to open a new question. I will look out for it, and see if others can give advice too. In the meantime, think you could post your data here? I'd like to tinker with it a bit.
Stephan Lallinger
on 2 Nov 2019
Edited: Stephan Lallinger
on 4 Nov 2019
Categories
Find more on Bartlett in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!