Powerline interference in ECG

14 views (last 30 days)
Sara Cooper
Sara Cooper on 21 May 2016
Answered: Star Strider on 16 Nov 2024 at 14:00
Could anyone help me with a code for removing 50 Hz in ECG with a notch filter?I'm using this code for now, but the attenuation doesn't seem enough to notice any difference in the signal. Perhaps another kind of filter would do better?
ECG=signal; Fs=300; Fo=50; Fon=Fo/Fs;
f1=45; f2=55; Bz=fir1(2000,[f1/Fs f2/Fs ],'stop'); y2=filter(Bz,1,b);
figure; plot(ECG); figure; plot(y2);

Answers (3)

Ullas
Ullas on 8 Jun 2023
Hi, i need a code for pli removal in ecg signal

Satheeshkumar
Satheeshkumar on 16 Nov 2024 at 4:12
Rejection of 60 Hz power-line interference from ECG signals. Write a Matlab program to implement the notch filter. Apply the filter to the signal in the data file ecg 60hz 200.dat available at DSP, dat files. Plot the ECG signal before and after filtering. Study the nature of the artifacts in the noisy signal and in the output of the filter

Star Strider
Star Strider on 16 Nov 2024 at 14:00
Try this —
Fs = 256; % Signal Sampling Frequency
Fn = Fs/2; % Nyquist Frequeency
Ws = [59 61]/Fn; % Passband Frequencies
Wp = Ws+[-1 1]/Fn; % Stopband Freqnencies
Rp = 1; % Passband Ripple (dB)
Rs = 60; % Stopband Ripple (Attenuation) (dB)
[n, Wp] = ellipord(Wp, Ws, Rp, Rs); % Calculate Filter Order
[z,p,k] = ellip(n, Rp, Rs, Wp, 'stop'); % Design Filter
[sos,g] = zp2sos(z, p, k); % Implement Filter As Second-Order-Seection
figure
freqz(sos, 2^20, Fs) % Filter Bode Plot
figure
freqz(sos, 2^20, Fs) % Filter Bode Plot (Deetail)
set(subplot(2,1,1), 'Xlim',[55 65], 'XTick',55:65)
set(subplot(2,1,2), 'Xlim',[55 65], 'XTick',55:65)
Use the filtfilt function to do the actual filtering.
Make appropriate changes to work with your signal.
.

Community Treasure Hunt

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

Start Hunting!