0% found this document useful (0 votes)
70 views4 pages

Task 3 PDF

Uploaded by

varsh kolla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views4 pages

Task 3 PDF

Uploaded by

varsh kolla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

TASK – 3

ECG SIGNALS ANALYSIS

Name: Naga Veda Varsha Kolla

Reg.No: 21BEC2176

Date: 26-02-2023

Lab Slot: L15+L16

Obejctive : To use MATLAB for spectral analysis of ECG signals

Question 1 :

1. Filter the noisy ECG signal in the file ecg_hfn.dat (See also the file ecg_hfn.m; fs = 1, 000 Hz.)
using four different Butterworth lowpass filters (individually) realized through MATLAB with
the following characteristics: (a) Order 2. cut-off frequency 10 Hz; (b) Order 4. cut-off
frequency 20 Hz: (c) Order 6. Cutoff frequency 40 Hz. (d) Order 8. cutoff frequency 70 Hz.
Use "help butter" and "help filter" in MATLAB to get details about the Butterworth filler.
Compare the results obtained using each of the four Butterworth filters.
2. ECG = load('ecg_hfn.dat'); Fs = 1000;
3. len = length(ECG); t = (1:len)/Fs;
4. Fp = 3500;
5. figure subplot(3,2,1) plot(t,ECG); xlabel('Time(s)');
6. ylabel('ECG'); title('Raw Signal')
7.
8. N1 = 2;
9. Wc1 = 10;
10.
11. [b1,a1] = butter(N1,Wc1/(Fs/2),'high');
12. sig1 = filter(b1,a1,ECG); subplot(3,2,2);
13. plot(t,sig1); grid on xlabel('Time(s)');
14. ylabel('ECG Signal');
15. title('Filtered ECG Signal');
16.
17. N2 = 4;
18. Wc2 = 20;
19. [b2,a2] = butter(N2,Wc2/(Fs/2),'high');
20. fsig2 = filter(b2,a2,ECG); subplot(3,2,3);
21. plot(t,smooth(fsig2)); grid on xlabel('Time(s)');
22. ylabel('ECG');
23. title('Filtered ECG signal 2');
24.
25. N3 = 6;
26. Wc3 = 40;
27. [b3,a3] = butter(N3,Wc3/(Fs/2),'high');
28. fsig3 = filter(b3,a3,ECG); subplot(3,2,4);
29. plot(t,fsig3); grid on xlabel('Time(s)');
30. ylabel('ECG');
31. title('Filtered ECG signal 3');
32.
33. N4 = 8;
34. Wc4 = 70;
35. [b4,a4] = butter(N4,Wc4/(Fs/2),'high');
36. fsig4 = filter(b4,a4,ECG); subplot(3,2,5);
37. plot(t,fsig4); grid xlabel('Time(s)');
38. ylabel('ECG');
39. title('Filtered ECG signal 4');

OUTPUT

INFERENCE : here we can see that due to change in the order and the cutoff
frequency we can the result of the noise signal . higher the order and the cutoff
frequency more messy is the signal.

question 2 :

Filler the signal in the file ecg_lfn.dat using Butterworth high pass filters by changing the order range
2 -8 and cutoff frequencies range 0.5- 5 Hz. (See also the file ecg_lfn.m.) Study the efficacy of the
filters in removing the base-line artifact and the effect on the ECG waveform itself. Determine the
best compromise acceptable.
Code :
ECG1 = load('ecg_lfn.dat'); Fs = 1000;
len = length(ECG1); t = (1:len)/Fs;
Fp = 3500;
figure subplot(3,2,1) plot(t,ECG1); xlabel('Time(s)');
ylabel('ECG1'); title('Raw Signal');

N1 = 2;
Wc1 = 0.5;
[b1,a1] = butter(N1,Wc1/(Fs/2),'high');
sig1 = filter(b1,a1,ECG1); subplot(3,2,2);
plot(t,sig1); grid on xlabel('Time(s)');
ylabel('ECG1 Signal'); title('Filtered ECG Signal');

N2 = 8;
Wc2 = 3;
[b2,a2] = butter(N2,Wc2/(Fs/2),'high');
fsig2 = filter(b2,a2,ECG1); subplot(3,2,3);
plot(t,smooth(fsig2)); grid on xlabel('Time(s)');
ylabel('ECG1');

title('Filtered ECG signal 2');

N3 = 8;
Wc3 = 4;
[b3,a3] = butter(N3,Wc3/(Fs/2),'high');
fsig3 = filter(b3,a3,ECG1); subplot(3,2,4);
plot(t,fsig3); grid on xlabel('Time(s)');
ylabel('ECG1'); title('Filtered ECG signal 3');

N4 = 8;
Wc4 = 5;
[b4,a4] = butter(N4,Wc4/(Fs/2),'high');
fsig4 = filter(b4,a4,ECG1); subplot(3,2,5);
plot(t,fsig4); grid xlabel('Time(s)');
ylabel('ECG1'); title('Filtered signal - ');

figure;
ts = 0.0004;
T = [0:len-1]*ts; Yn = fft(ECG1,len); plot(T,abs(Yn));
title("FFT");

OUTPUT
INFERENCE : here we can see that as the order and the cutoff frequency changes , the signal’s
frequencies and the amplitudes of the peaks keeps changing ; the frequency increases and the
amplitude changed from 3 to 1 when the order changed from 0.5 to 3

You might also like