MATLAB: Filtering ECG signal using 4th order low pass filter

butterworth filterecg filterlow-pass filter

hello friends, i have written matlab code for 4th order butterworth filter of 70 hertz along with poles, zeros, transfer. Now, how can i apply this designed filter on an ecg signal? thanks. i am sharing my code here. clc; wc= 70; N= 4; K= 2.575; for k= 0:N-1 Sk(k+1)= wc*exp(1i*(pi/2))*exp(1i*(2*k+1)*(pi/(2*N)));
end
[NUM,DEN]=zp2tf([],Sk,K);
b0=DEN(end)*K;
Hs=tf(b0,DEN);
figure();
freqs(b0,DEN)
figure();
plot(Sk./10^2, 'x')
xlim([-10,10]);
title('Pole placement in s-plane')
%
for x = 1:10
disp(x)
end
[NUM,DEN]=lp2lp(NUM,DEN,wc);
fs=1000;
[NUMd,DENd]=bilinear(NUM,DEN,fs);
disp('NUMd='),disp(NUMd')
disp('DENd='),disp(DENd')
[Hd,wd]=freqz(NUMd,DENd);
Magd=abs(Hd);
subplot(2,1,1);
plot(wd/pi,Magd);
grid on;
title('Digital Lowpass Butterworth Filter');
ylabel('Amplitude response')
axis([0 0.2 0 1])
subplot(2,1,2);
plot(wd/pi,angle(Hd));
grid on;
axis([0 0.2 -200 200])
ylabel('Phase response')
xlabel('Frequency,[unit of pi]')

Best Answer

You can try in following way- For detail visit here
tic;
while toc<t %mention time of the signal to be observed here e.g. t=20,30 etc
filtered_ECG_Signal=mgd(Original_ECG_signal); %make the designed filer as a custom function or you can apply directly too.
TS(Original_ECG_signal,filtered_ECG_Signal);
end
% Finalize
release(TS)
Related Question