ECG SIGNAL PROCESSING

agerasiaetherealΤεχνίτη Νοημοσύνη και Ρομποτική

24 Νοε 2013 (πριν από 3 χρόνια και 8 μήνες)

189 εμφανίσεις


ECG SIGNAL PROCESSING


Project one

Group #5


David Kebede

Archana Jagannatam

Mustafa Ibrahim

Introduction


This project deals with the signal processing of the ECG signal. Here we apply Fast Fourier
Transform(FFT), which is an effective way to compute the Discrete Fourier Transform to both
the given ecg and noise_ecg signal. We make the DC component of the FFT
output as zero. Then
the FFTSHIFT is applied, this shifts zero frequency components to center of the spectrum.


A notch filter rejects a narrow frequency and leaves the rest of the spectrum slightly changed. A
notch filter is commonly used in audio applic
ations to suppress noise.

In this project we are asked to design a notch filter at two different values of Q=6 and Q=60 with
3dB bandwidth, then apply this noise filter to cleanup “noise_ecg” signal.


Methods


First of all we downloaded the “ecgdata.mat’
’ from the course website. This m
-
file
contains the clean signal, “ecg” and the distorted signal, “noise_ecg” which is obtained
by adding power interference of 60Hz into “ecg”. Then the FFT is applied to both the
signals with the DC component of FFT output

as zero. Given that f0=60Hz and
fs=360Hz. A plot of magnitude versus frequency is plotted within the range of

fs/2 to
fs/2.


Matlab code for “ecg” signal:

fs=360; %360Hz is the sampling rate

fo=60; %60Hz is the added power interference to obtain the "ecg
" and

%"noise_ecg"

n=1:1024;

xn=ecg; %set xn equal to the ecg signal

xnfft=fft(xn,1024);

xnfft(1)=0; % X[1]=0 to eliminate the huge DC components from signal

xn=fftshift(xnfft);

f=linspace(
-
fs/2,fs/2,1024); %to create equal spacing

plot(f,abs(xnfft)); %to plot the magnitude of spectrum versus frequency

xlabel(‘frequency(Hz)’);

ylabel(‘ magnitude ‘);

title(‘ Plot for the magnitude versus frequency spectrum of ecg signal’);

grid; %include grid lines

Matlab code for noise_ecg signal:

f
s=360; %360Hz is the sampling rate

fo=60; %60Hz is the added power interference to obtain the "ecg" and

%"noise_ecg"

n=1:1024;

xn=noise_ecg; %set xn equal to the noise_ecg signal

xnfft=fft(xn,1024);

xnfft(1)=0; % X[1]=0 to eliminate the huge DC componen
ts from signal

xn=fftshift(xnfft);

f=linspace(
-
fs/2,fs/2,1024); %to create equal spacing

plot(f,abs(xnfft)); %to plot the magnitude of spectrum versus frequency

xlabel(‘frequency(Hz));

ylabel(‘ magnitude ‘);

title(‘ Plot for the magnitude versus
frequency spectrum of noise_ecg signal’);

grid; %include grid lines


Notch filter designing:

Matlab code for Q = 6:

x=noise_ecg;

a=[.9202
-
.83984];

b=[1 1 1];

y=filter(b,a,x);

plot(y)

xlabel('frequency(Hz)');

ylabel('magnitude');

title(' notch filter for
Q=6');


Matlab code for Q = 60:

x=noise_ecg;

a=[.9917
-
.9827];

b=[1 1 1];

y=filter(b,a,x);

plot(y)

xlabel('frequency(Hz)');

ylabel('magnitude');

title(' notch filter for Q=60');

Calculation:


Given values: f0 = 60Hz, fs=360Hz, Q=6, Q=60


w0 =(2*pi*f0)/fs

= (2*pi*60)/360 = pi/3 = 1.0471975512

=
1.047


∆w = w0/Q %when Q=6

= 1.0471975512 / 6

= 0.174532925199

=0.175

b = 1 / [1+tan(∆w/2)]

= 0.919924318134

=
0.9199

∆w = w0/Q %when Q=60

= 1.0471975512 / 60

= 0.01745329252

=0.0175

b = 1 / [1+tan(∆w/2)]

= 0.9913506

=
0.9914


Designing the notch filter:



b*[1
-
2cos(w0z^
-
1)+z^
-
1]

H(z) =
---------------------------------------------

[1
-
2bcos(w0z^
-
1) + (2b
-
1)z^
-
1]


b*[1
-

2cos(w0*e^
-
jw) + e^
-
jw]

H(jw) =
-------------------------------------------------

[1
-
2bcos(w0*e^
-
jw) + (2b
-
1)e^
-
jw]



% when Q=6


0.9199*[1
-

2cos(w0*e^
-
jw) + e^
-
jw]

H(jw) =
--------------------------------------------------------------------

[1
-
(2*0.9199)*cos(w0*e^
-
jw) + (2*0.9199
-
1)e^
-
jw]






% when Q=60


0.9914*[1
-

2cos(w0*e^
-
jw)

+ e^
-
jw]

H(jw) =
--------------------------------------------------------------------

[1
-
(2*0.9914)*cos(w0*e^
-
jw) + (2*0.9914
-
1)e^
-
jw]
























Results















































Conclusion


In this project we leaned

how to design a notch filter to be able eliminate unwanted
noise obtained while taking measurements.

While the task of applying the FFT function was straight forward, we were challenged
with the design of the notch filter. However, after many tries we fee
l we have designed
the notch filter which is able to filter out the noise.

Based on this project we feel we have some understanding on how this type of filter can
be useful in “ecg” measurement where there may be great deal of noise interference.