How do I eliminate multiple 60Hz harmonics within 1 set of data in an ECG

56 views (last 30 days)
I have an ECG signal and I'm trying to filter out the 60 Hz harmonics at 60, 120, 180 etc. I am currently using a digital biquad filter. I am currently running into the problem that they are not within one data set so when I plot them with the ECG singal it's not plotting one graph with both 60 AND 120 minimized, it's plotting 1 graph with 60 Hz minimized and 1 graph with 120 Hz minimized on top of each other. I've tried a for loop and just rewriting the code using hold on to continue to plot. How do I get them so that they are all in within the same set of data and not different plots on top of each other for each? Here is some of my current code that is showing JUST the 60 Hz harmonic minimized:
dz= .0005; % d = 1/Q
dp= 0.3;
w= 2*pi*(60); % notch frequency in radians/sec
B =[1 dz*w w^2];
A =[1 dp*w w^2];
h = tf(B,A);
hd =c2d(h,1/Fs,'tustin'); %Fs= 2000 Hz
filter_x = filter(hd.Numerator{1},hd.Denominator{1},x);
plot(filter_x)

Accepted Answer

Star Strider
Star Strider on 13 Jun 2019
The Signal Processing Toolbox is best for this. See: Remove the 60 Hz Hum from a Signal (link). You’ll need to design a separate filter for each harmonic.
If you have R2018a or later, the bandstop (link) function makes such filter design and implementation easy.
  4 Comments

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!