code of notch filter
21 views (last 30 days)
Show older comments
Can any one help me how I can do notch filter in matlab?
0 Comments
Answers (3)
Kiran
on 26 Dec 2022
clc
clear all
close all;
load 231m
data1=(val(1,:));
% data=data1/200;
data=(data1-1024)/200;
EKG=data;
% D = load('Sara Cooper ecgNoise.mat');
% EKG = D.DD2; % Signal
L = length(EKG); % Signal Length (samples)
Fs = 300; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
t = (0:L-1)/Fs; % Time Vector (sec)
figure(1)
plot(t, EKG)
grid
axis([0 3 ylim])
FTEKG = fft(EKG)/L; % Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(2)
semilogy(Fv, abs(FTEKG(Iv))*2)
grid
axis([0 7.5 ylim])
Fs = 300; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency
Wp = [1 100]/Fn; % Passband (Normalised)
Ws = [0.5 110]/Fn; % Stopband (Normalised)
Rp = 10; % Passband Ripple (dB)
Rs = 30; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp, Ws, Rp, Rs); % Chebyshev Type II Order
[b,a] = cheby2(n, Rs, Ws); % Transfer Function Coefficients
[sos,g] = tf2sos(b,a); % Second-Order-Section For Stability
EKG_F = filtfilt(sos, g, EKG);
figure(3)
plot(t, EKG_F)
grid
axis([0 3 ylim])
title('Star Strider’s Bandpass Filtered EKG')
xlabel('Time (sec)')
ylabel('Amplitude (mV?)')
1 Comment
Sumit
on 11 May 2023
hello, i want design such filter for ECG signal which is in the .wav file. how i do this ?
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!