Sunteți pe pagina 1din 21

KONERU LAKSHMIA UNIVERSITY

DEPARTMENT OF ELECTRONICS AND COMMUNICATION

ENGINEERING

SKILLING PROJECT

ON

DESIGN OF DIGITAL NOTCH FILTER FOR ECG SIGNAL ENHANCEMNET


SUBMITTED BY
I.D NO NAME

Ch. Sahithi 170040128

T. Srinivas 170040131

Ch.V.V.V.Vinod Chowdary 170040142

UNDER THE ESTIMATE GUIDANCE OF

V.SAHITHI

KTP.SATISH KUMAR

KL UNIVERSITY

GREEN FIELDS, VADDESWARAM-522502


GUNTUR (DIST)., AP, INDIA
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

ENGINEERING

CERTIFICATE

This is to certify that the project based laboratory report entitled “DESIGN OF DIGITAL
NOTCH FILTER FOR ECG SIGNAL ENHANCEMNET ” submitted by Ch. Sahithi (170040128), T.
Srinivas (170040131), Ch.V.V.V.Vinod Chowdary (170040142), Ch. Sri Hari Chandana
(170040147), to the Department of electronics and communication engineering, KL
University in partial fulfilment of the Requirements for the completion of a project
based Laboratory in “SKILLING” course in B Tech 4th Semister, is a bonafide record of
the work carried out by him under my supervision during the academic year 2018-2019.

PROJECT SUPERVISOR COURSE COORDINATOR


HEAD OF THE DEPARTMENT

ACKNOWLEDGEMENTS

It is great pleasure for me to express my gratitude to our honorable President


Sri. Koneru Satyanarayana, for giving the opportunity and platform with facilities in
accomplishing the project based laboratory report.

I express the sincere gratitude to our principal Dr. K.SUBBA RAO for his
administration towards our academic growth.

I express sincere gratitude to our Coordinator for his leadership and constant
motivation provided in successful completion of our academic semester.

I record it as my privilege to deeply thank our pioneer Dr. CH.SREE KAVYA,


HOD-ECE for providing us the efficient faculty and facilities to make our ideas into
reality.

I express my sincere thanks to our project supervisor by V.SAHITHI and


KTP.SATISH KUMAR for his novel association of ideas, encouragement,
appreciation and intellectual zeal which motivated us to venture this project
successfully.

Finally, it is pleased to acknowledge the indebtedness to all those who devoted


themselves directly or indirectly to make this project report success.
ABSTRACT

Electrocardiography (ECG or EKG) is the process of recording the electrical activity of


the heart over a period of time using electrodes placed over the skin. These electrodes detect
the tiny electrical changes on the skin that arise from the heart muscle's electrophysiologic
pattern of depolarizing and repolarizing during each heartbeat. It is very commonly performed
to detect any cardiac problems.

In ECG recording noise may occur corrupting the original information, noise occurs due to
many factors for example, misplacement of electrodes, and interference due to stray effect of
the alternating current fields due to loops in the patient’s cables. Other causes are loose contacts
on the patient’s cable as well as dirty electrodes. When the machine or the patient is not
properly grounded, power line interference may even completely obscure the ECG waveform.

Here, we are trying to remove the power line interference by using notch filter through which
we can obtain the ECG recording without no power line interference. A notch filter is a band-
stop filter with a narrow stopband (high Q factor). A band-stop filter or band-rejection filter is
a filter that passes most frequencies unaltered, but attenuates those in a specific range to very
low levels. Here the proposed technique for notch filter design is implemented through a matlab
code and simulated for the performance analysis of designed filter in removing the noise in
ECG signal.
INDEX

S.NO TITLE PAGE.NO

1 Introduction 6

2 Aim of the Project 12

2.1 Advantages & Disadvantages 12

2.2 Future Implementation 12

3 software & hardware details 12

4 Implementation 13

5 Conclusion 21
INTRODUCTION
An electrocardiogram (ECG or EKG, abbreviated from the German
Elektrokardiogramm) is a graphic produced by an electrocardiograph, which records the
electrical activity of the heart over time. Its name is made of different parts: electro, because it
is related to electronics, cardio, Greek for heart, gram, a Greek root meaning "to write".The
electrocardiogram (ECG) is a diagnostic tool that is routinely used to assess the electrical and
muscular functions of the heart. It is also a noninvasive test that records the electrical activity
of the heart over time and it is very useful in the investigation of heart disease, for example a
cardiac arrhythmia. The ECG signal is trace of an electrical activity signal generated by
rhythmic contractions of the heart and it can be measured by electrodes placed on the body’s
surface. An electrode lead, or patch, is placed on each arm and leg and six are placed across
the chest wall. The signals received from each electrode are recorded.

Fig. 1 depicts each ECG signal of normal heart beat consists of six continuous electromagnetic
peaks namely PQRST and U.The electrocardiogram can measure the rate and rhythm of the
heartbeat, as well as provide indirect evidence of blood flow to the heart muscle. A typical
ECG tracing of the cardiac cycle (heartbeat) consists of a P wave, a QRS complex, a T wave,
and a U wave, which is normally invisible in 50 to 75% of ECGs because it is hidden by the T
wave and upcoming new P wave.[29] The baseline of the electrocardiogram (the flat horizontal
segments) is measured as the portion of the tracing following the T wave and preceding the
next P wave and the segment between the P wave and the following QRS complex (PR
segment). In a normal healthy heart, the baseline is equivalent to the isoelectric line (0mV) and
represents the periods in the cardiac cycle when there are no currents flowing towards either
the positive or negative ends of the ECG leads. However, in a diseased heart the baseline may
be elevated (e.g. cardiac ischaemia) or depressed (e.g. myocardial infarction) relative to the
isoelectric line due to injury currents flowing during the TP and PR intervals when the
ventricles are at rest. The ST segment typically remains close to the isoelectric line as this is
the period when the ventricles are fully depolarised and thus no currents can flow in the ECG
leads. Since most ECG recordings do not indicate where the 0mV line is, baseline depression
often gives the appearance of an elevation of the ST segment and conversely baseline elevation
gives the appearance of depression of the ST segment.Originally, four deflections were noted,
but after the mathematical correction for artifacts introduced by early amplifiers, a fifth
deflection was discovered. Einthoven chose the letters P, Q, R, S, and T to identify the tracing
which was superimposed over the uncorrected labeled A, B, C, and D.In intracardiac
electrocardiograms, such as can be acquired from pacemaker sensors, an additional wave can
be seen, the H deflection, which reflects the depolarization of the bundle of His.[33] The H-V
interval, in turn, is the duration from the beginning of the H deflection to the earliest onset of
ventricular depolarization recorded in any lead.Interpretation of the ECG relies on the idea that
different leads (meaning the ECG leads I, II, III, aVR, aVL, aVF and the chest leads) "view"
the heart from different angles. This has two benefits. Firstly, leads which are showing
problems (for example ST segment elevation) can be used to infer which region of the heart is
affected. Secondly, the overall direction of travel of the wave of depolarisation can also be
inferred which can reveal other problems. This is termed the cardiac axis . Determination of
the cardiac axis relies on the concept of a vector which describes the motion of the
depolarisation wave.

This vector can then be described in terms of its components in relation to the direction of the
lead considered. One component will be in the direction of the lead and this will be revealed
in the behaviour of the QRS complex and one component will be at 90° to this (which will
not). Any net positive deflection of the QRS complex
(i.e. height of the R-wave minus depth of the S-wave) suggests the wave of depolarisation is
spreading through the heart in a direction that has some component (of the vector) in the same
direction as the lead in question.

The ECG signal corrupted due to different types of artifacts and interferences such as Power
line interference, Electrode contact noise, Muscle contraction, Base line drift, Instrumentation
noise generated by electronic and mechanical devices, Electrosurgical noise.From various
artifacts contaminate electrocardiogram (ECG) recording, the most common are power line
interference.

Modern ECG monitors offer multiple filters for signal processing. The most common settings
are monitor mode and diagnostic mode. In monitor mode, the low-frequency filter (also called
the high-pass filter because signals above the threshold are allowed to pass) is set at either 0.5
Hz or 1 Hz and the high-frequency filter (also called the low-pass filter because signals below
the threshold are allowed to pass) is set at 40 Hz. This limits artifacts for routine cardiac
rhythm monitoring.

The high-pass filter helps reduce wandering baseline and the low-pass filter helps reduce 50-
or 60-Hz power line noise (the power line network frequency differs between 50 and 60 Hz
in different countries). In diagnostic mode, the high-pass filter is set at 0.05 Hz, which allows
accurate ST segments to be recorded. The low-pass filter is set to 40, 100, or 150 Hz.
Consequently, the monitor mode ECG display is more filtered than diagnostic mode, because
its passband is narrower.

POWER LINE INTERFERENCE


Power line interference is easily recognizable since the interfering voltage in the ECG may
have frequency 50 Hz. The interference may be due to stray effect of the alternating current
fields due to loops in the patient’s cables. Other causes are loose contacts on the patient’s
cable as well as dirty electrodes. When the machine or the patient is not properly grounded,
power line interference may even completely obscure the ECG waveform.

The most common cause of 50 Hz interference is the disconnected electrode resulting in a


very strong disturbing signal, and therefore needs quick action. Electromagnetic interference
from the power lines also results in poor quality tracings. Electrical equipments such as air
conditioner, elevators and X-ray units draw heavy power line current, which induce 50 Hz
signals in the input circuits of the ECG machine. Electrical power systems also induce
extremely rapid pulse or the spike on the trace, as a result of switching action. Care should be
taken to suppress these transients.

For the meaningful and accurate detection,steps have to be taken to filter out or discard the
noise source. Analog filters help in dealing with these problems; however, they may introduce
nonlinear phase shifts, skewing the signal. Also, the instrumentation depends on resistance,
temperature, and design, which also may introduce more error. With more recent technology,
Digital filters are now capable of being implemented offering more advantages over the analog
one. Digital filters are more precise due to a lack of instrumentation.

The work on design and implementation of Digital filter on the ECG signal is in progress in
the different part of the world. The investigation addressed the analysis of the effects of AC
interference and its filtering on the precision and accuracy of heart rate detection. Removal of
noises from ECG signal is a classical problem and many researchers work on signal noise
removing by different filtering method and algorithms.power line interference reduction is the
first step in all electrocardiography signal processing.Several techniques have been presented
for this purpose, ranging from straightforward linear, bandstop filtering to more advanced
techniques that handle variations in powerline frequency and suppress the influence of
transients manifested by the occurrence of QRS complexes.
A major concern when filtering out powerline interference is the degree to which the QRS
complexes influence the output of the filter. The QRS complex acts, in fact, as an unwanted,
large-amplitude impulse input to the filter.As linear, time-invariant notch filters are generally
more sensitive to the presence of such impulses, powerline filters with a nonlinear structure
may be preferable.In order to assure that a filter does not introduce unacceptable distortion,
its performance should be assessed by means of simulated signals so that distortion can be
exactly quantified.

NOTCH FILTER
Simplest filter to remove the power line is Notch filter.A notch filter is a band-stop filter with
a narrow stopband.A band-stop filter or band-rejection filter is a filter that passes most
frequencies unaltered, but attenuates those in a specific range to very low levels. It is the
opposite of a band-pass filter.

Figure 3 shows A general ideal band-stop filter, showing both positive and negative angular
frequencies.

A notch filter removes a particular frequency from a signal and has a frequency response that
falls to zero over a narrow range of frequencies (i.e. a 50 Hz notch may block signals from
49.5 – 50.5 Hz).

The digital notch filter is consisted of the fast Fourier transform, a second order infinite
impulse response notch filter, inverse fast Fourier transform, real and imaginary parts
separating, phase shift for imaginary part, and pure noise eliminating from real and imaginary
parts. A smooth waveform of low frequency photoacoustic signal can be achieved through the
50Hz digital notch filter and can be used as the analysis data to calculate the target gas
concentration.
INFINITE IMPULSE RESPONSE
Infinite impulse response (IIR) is a property applying to many linear time-invariant
systems. Common examples of linear time-invariant systems are most electronic and
digital filters. Systems with this property are known as IIR systems or IIR filters, and are
distinguished by having an impulse response which does not become exactly zero past a
certain point, but continues indefinitely.

This is in contrast to a finite impulse response in which the impulse response h(t) does
become exactly zero at times t > T for some finite T, thus being of finite duration.In
practice, the impulse response even of IIR systems usually approaches zero and can be
neglected past a certain point. However the physical systems which give rise to IIR or FIR
responses are dissimilar, and therein lies the importance of the distinction. For instance,
analog electronic filters composed of resistors, capacitors, and/or inductors (and perhaps
linear amplifiers) are generally IIR filters. On the other hand, discrete-time filters (usually
digital filters) based on a tapped delay line employing no feedback are necessarily FIR
filters.Although almost all analog electronic filters are IIR, digital filters may be either IIR
or FIR. The presence of feedback in the topology of a discrete-time filter generally creates
an IIR response.

In matlab we have an inbuilt function ‘’IIR notch’’, which turns a digital notching filter
with the notch located at required value(w0), and with the bandwidth at the -3 dB point set
to required bandwidth. In this project we take an ECG signal which is the ideal one i.e.,
without noise in time domain.

Fig 4 Diagram of Actual ECG signal with identification


AIM:-
A Program to design of digital notch filter for ECG signal enhancement.

ADVANTAGES:-
 With this design the ECG signal becomes noise immune, thus more accurate results
are obtained.
 Power line interference is removed so that clear information of ECG signal is drawn
 Environmental conditions do not effect the ECG signal output information.

FUTURE ENHANCEMENTS:-
Noise removal from ECG signal is very important. Some techniques like using notch filter
are used to remove the noise in ECG signal. In future work, reducing noise by improving the
parameter will be a challenge. It gives us the real concepts along with theoretical background
reduction of powerline interference, single frequency, high frequency tones noise from
original ECG signal. This increases the understanding and self confidence in the field of
electronical engineering as well as biomedical engineering.

SYSTEM REQUIREMENTS:- 

 SOFTWARE REQUIREMENTS:
The major software requirements of the project are as follows:

Language : Matlab

Operating system : Windows Xp or later


IMPLEMENTATION

TASK 1: To plot an ECG signal


clc;clear all;

close all;

Fs=500;

L=1024;

t=0:(2/L)-1:1;

x=repmat(ecg(Fs),1,8);

figure(1);

subplot(311);

plot(x)

xlabel('time (in secs)');

ylabel('amplitude of x');

title('ecg signal');

xn=fft(x,1024);

f=linspace(-Fs/2,Fs/2,1024);

subplot(312);

plot(f,abs(xn)); %plot magnitude spectrum

xlabel('frequency (Hz)');

ylabel('amplitude');

title('magnitude spectrum of signal(fft)');

subplot(313);

stem(abs(xn(1:L/2)));%plot first half of of DFT(normalised frequency)

xlabel('normalised frequency(Hz)'); ylabel('amplitude');

title('First half of DFT');


TASK 2: Adding noise to the ecg signal
clc;clear all;close all;

Fs=500;

L=1024;

t=0:(2/L)-1:1;

k=1:3000;

x1=0.1*sin(2*pi*50*(k-1)/Fs); % sampled 0.1mV/ 50Hz powerline noise;

x=3.5*ecg(3000); % sampled 3.5mV ecg signal;

d=x1+x;

plot(d)

xlabel('amplitude');

ylabel('time');

title('after adding noise to the ecg siganl');


TASK 3: Denoising the ECG signal with the help of an iir notch filter

clc;clear all;close all;

%plot ECG signal in time domain and implement Notch Filter to remove

%50 Hz with Q fator 1

fs=1024;

w=50/(fs/2);

bw=w/1;

[num,den]=iirnotch(w,bw);

[h,w]=freqz(num,den,512);

HdB=20*log10(abs(h)); % computes the magnitude vector in dB;


phaseangle=unwrap(angle(h)); % computes unwrap phase angle vector;

figure(1);

impz(num) % plots the impulse response of the filter;

figure(2);

subplot(211);

plot(w/pi,HdB); % plots the magnitude response of the filter in dB;

xlabel('normalized frequency');

ylabel('manitude(db)');

title('magnitude response of the notch filter')

subplot(212);

plot(w/pi,phaseangle) % plots the phase response of the filter;

xlabel('normalized frequency')

ylabel('phase(degrees)');

title('phase response of the notch filter');

k=1:3000;

x1=0.1*sin(2*pi*50*(k-1)/fs); % sampled 0.1mV/ 50Hz powerline noise;

x=3.5*ecg(3000); % sampled 3.5mV ecg signal;

d=x1+x; % contaminated ecg signal;

figure(3);

subplot(311);

N1=length(x);

t=[0:N1-1]/fs;

plot(t,x);
xlabel('time index');

ylabel('amplitude');

title('ECG signal');

subplot(312);

N2=length(x1);

t1=[0:N2-1]/fs

plot(t,x1);

xlabel('time index');

ylabel('amplitude');

title('noise that is added to the ECG sinal');

subplot(313);

N3=length(d);

t2=[0:N3-1]/fs

plot(t,d);

xlabel('time index');

ylabel('amplitude');

title('The ECG signal after adding the noise')

y=filter(num,den,d); % filters the ecg signal;

figure(4);

subplot(411);

plot(t,x) % plots samples the clean ecg sigal;

xlabel('time index');

ylabel('amplitude');
title('Samples of the clean ecg signal');

subplot(412);

plot(t2,d) % plots the contaminated ecg signal;

xlabel('time index');

ylabel('amplitude');

title('The contaminated ECG signal');

subplot(413);

periodogram(d) % plots the frequency spectrum of the contaminated ecg signal;

xlabel('time index');

ylabel('amplitude');

title('The frequency spectrum of the contaminated ecg signal');

subplot(414);

N4=length(y);

t=[0:N4-1]/fs

plot(t,y) % plots the filtered ecg signal;

xlabel('time index');

ylabel('amplitude');

title('The filtered ECG signal');


CONCLUSION

The digital notch filter is designed to remove the power line interference from ECG signal
was proposed. The results obtained from notch filter is applied to the ECG signal .The notch
filter was designed by using signal processing Tool in MATLAB ®2014a software. Hence by
observing signal to noise ratio of ECG before and after filtering we can say that the digital
notch filter gives more accurate results .Therefore it is concluded that the digital notch filter
performs better when compared to all digital filters for elimination of power line interference
from ECG signals.

S-ar putea să vă placă și