0% found this document useful (0 votes)
122 views

Complex Engineering Problem

The ECG signal contains important information for diagnosing heart conditions, but is often contaminated by noise that can interfere with analysis. There are three main types of noise: baseline wander below 0.5 Hz, electromyography interference, and powerline interference at 50 or 60 Hz. To remove these, the team designed a filter using FIR high-pass filtering with a 0.5 Hz cutoff to remove baseline wander. For powerline interference, they designed an IIR notch filter centered at 50 or 60 Hz with a bandwidth of 5 Hz. Testing on an ECG signal showed these filters could remove the low-frequency baseline wander noise and powerline interference while preserving the ECG signal.

Uploaded by

talha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views

Complex Engineering Problem

The ECG signal contains important information for diagnosing heart conditions, but is often contaminated by noise that can interfere with analysis. There are three main types of noise: baseline wander below 0.5 Hz, electromyography interference, and powerline interference at 50 or 60 Hz. To remove these, the team designed a filter using FIR high-pass filtering with a 0.5 Hz cutoff to remove baseline wander. For powerline interference, they designed an IIR notch filter centered at 50 or 60 Hz with a bandwidth of 5 Hz. Testing on an ECG signal showed these filters could remove the low-frequency baseline wander noise and powerline interference while preserving the ECG signal.

Uploaded by

talha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Complex Engineering Problem

Submitted by: 2018-EE-503 (M.Talha)

2018-EE-506 (Ali Raza)

Statement:
The ECG test measures the electrical activity of the heartbeat and plays key role in diagnosing
diverse kinds of heart diseases. With each beat, an electrical impulse (or “wave”) travels through
the heart. This wave causes the muscle to squeeze and pump blood from the heart. A normal
heartbeat on ECG will show the timing of the top and lower chambers.

Because the pulses produced by heart may have subtle differences from each other and noise
affects the decision accuracy, the ECG is commonly organized using precise electronic
equipment. Accurate measurements are especially required when data are used to extract features
of ECG signals and make decisions about different kinds of heart diseases employing special
software. However, even very precise measurements are typically contaminated by artefacts and
noise. Artefacts may result from a variety of internal and external causes, such as the
Parkinsonian muscle tremors drying electrode gel. Different kinds of noises may contaminate the
ECG signal during its acquisition and transmission, such as the high frequency noise
(electromyogram noise, additive white Gaussian noise, and power line interference) and low
frequency noise (baseline wandering). Because noise may lead to wrong interpretation, ECG
signal denoising is required. 

"There exist three types of noise that contaminate the ECG signal: the baseline wander noise
(BW), electromyographic interference (EMG), and the power line interference. The BW is
induced by electrodes’ changes due to perspiration, movement and respiration, and is typically
below 0.5 Hz. The power line interference either 50 Hz or 60 Hz and its harmonics are a
significant source of noise."

Our goal in designing the filter is to attenuate baseline wander noise and powerline interference.
It would take more sophisticated processing to track and cancel the EMG noise because EMG
noise appears in the same frequencies as the ECG signal.
Design and estimate the bandpass filter specifications.

Introduction:

Electrocardiogram (ECG) is a signal that describes the electrical activity of the heart. The ECG
signal is generated by contraction (depolarization) and relaxation (repolarization) of atrial and
ventricular muscles of the heart. The ECG signal contains- a P wave (due to atrial
depolarization), a QRS complex (due to atrial repolarization and ventricular depolarization) and
a T wave (due to ventricular repolarization). In order to record an ECG signal, electrodes
(transducers) are placed at specific positions on the human body. Artifacts (noise) are the
unwanted signals that are merged with ECG signal and sometimes create obstacles for the
physicians from making a true diagnosis. Hence, it is necessary to remove them from ECG
signals using proper signal processing methods.

Designing a filter:

The low pass filter is for 50 or 60 Hz noise and High pass filter is used to rectify
baseline wander.

Baseline Wander:

Baseline wander or baseline drift is the effect where the base axis (x-axis) of a signal appears to
‘wander’ or move up and down rather than be straight. It is caused due to improper electrodes
(electrode-skin impedance), patient’s movement and breathing (respiration). Since the baseline
signal is a low frequency signal therefore Finite Impulse Response (FIR) high-pass zero phase
forward-backward filtering with a cut-off frequency of 0.5 Hz to estimate and remove the
baseline in the ECG signal.
Wavelet transform can also be used to remove the baseline wander from ECG signal. The
frequency of baseline wander is approximately 0.5 Hz. According to discrete wavelet transform
(DWT), the original signal is to be decomposed using the subsequent low-pass filters (LPF) and
high-pass filters (HPF). The cut-off frequency for LPF and HPF will be half of the sampling
frequency. For example, if the sampling frequency is 250 Hz, then 125 Hz will be the cut-off
frequency for both LPF and HPF in the first level decomposition. In second level decomposition,
the cut-off frequency becomes 62.5 Hz, for third level decomposition it becomes 31.25 Hz and
so on. Thus, it will require nine- level decomposition using DWT to remove a baseline wander of
0.5 Hz frequency. Following is the Matlab code to remove baseline wander from an ECG signal
using DWT.

Designing a high pass filter:

A high-pass filter attenuates signals below a cutoff frequency (stop-band) and allows signal
above the cutoff frequency

We have H(e^jw) = 0 for 0<w<wc and H(e^jw) = 1 for 1<w<pi

Normalized cutoff freq = f/fs = 0.5/250 = 0.002Hz


In MATLAB we write

clear all
Fs = 360; % Sampling Frequency
N = 50; % Order
Fc = 0.667; % Cutoff Frequency
% Construct an FDESIGN object and call its BUTTER method.
h = fdesign. lowpass ('N,Fc', N, Fc, Fs);
Hd = butter(h);
x=load('100.txt'); % load the ECG signal
x1=x(:,2);
x2=x1./ max(x1);
subplot (2,1,1), plot(x2), title ('ECG Signal with low-frequency noise'), grid on
y0=filter (Hd, x2);
subplot (2,1,2), plot(y0), title ('ECG signal with baseline wander REMOVED'), grid on

[b2,a2]= butter(2,5/Fs,’high’)

We use Butterworth 2nd order filter and cutoff frequency 5Hz.

Freqz(b2,a2) gives magnitude and phase responses. And pole zero map by zplane(b2,a2). Then
filtfilt(b2,a2,x2) we used double filter.

Ideal high pass filter is shown as figure:


Output Should be of the form:

(Baseline corrected)

Powerline Interference:
Electromagnetic fields caused by a powerline represent a common noise source in the ECG, as
well as to any other bioelectrical signal recorded from the body surface. Suh noise is
characterized by 50 or 60 Hz sinusoidal interference, possibly accompanied by a number of
harmonics. Such narrowband noise renders the analysis and interpretation of the ECG more
difficult, since the delineation of low-amplitude waveforms becomes unreliable and spurious
waveforms may be introduced. It is necessary to remove powerline interference from ECG
signals as it completely superimposes the low frequency ECG waves.

An ideal low pass filter is shown in figure

A very simple approach to the reduction of powerline interference is to consider a filter defined
by a complex-conjugated pair of zeros that lie on the unit circle at the interfering frequency.

Zeros= a1,2 = e^+- jw0

Such a second-order FIR filter has the transfer function


H(z) = (1-a1z^-1)( 1-a2z^-1)
= 1-2cos(wo)z^-1 + z^-2

Since this filter has a notch with a relatively large bandwidth, it will attenuate not only the
powerline frequency but also the ECG waveforms with frequencies close to wo. It is, therefore,
necessary to modify the filter so that the notch becomes more selective, for example, by
introducing a pair of complex-conjugated poles positioned at the same angle as the zeros but at a
radius r,

Poles= b1,2= re^+-jwo

Where 0 < r < 1. Thus, the transfer function of the resulting IIR filter is given by

H(z) = (1-a1z^-1)( 1-a2z^-1) / H(z) = (1-b1z^-1)( 1-b2z^-1)

= 1-2cos(wo)z^-1 + z^-2 / 1-2rcos(wo)z^-1 + r^2.z^-2

[b1 a1] = cheby(8,80,50/Fn)

Chebyshev type 2 ,8th order, 80db stopband filter,


X2 = filtfilt(b1,a1,x);

Matlab code:

Clear all
Fs = 360; % Sampling Frequency
Fnotch = 0.67; % Notch Frequency
BW = 5; % Bandwidth
Apass = 1; % Bandwidth Attenuation
[b, a] = iirnotch (Fnotch/ (Fs/2), BW/(Fs/2), Apass);
Hd = dfilt.df2 (b, a);
x=load ('100.txt');
x1=x (:, 2);
x2=x1. / max(x1);
Subplot (3, 1, 1), plot(x2), title ('ECG Signal with baswline wander'), grid on
y0=filter (Hd, x2);
Subplot (3, 1, 2), plot(y0), title ('ECG signal with low-frequency noise (baswline wander) Removed'), grid on
Fnotch = 60; % Notch Frequency
BW = 120; % Bandwidth
Apass = 1; % Bandwidth Attenuation
[b, a] = iirnotch (Fnotch/ (Fs/2), BW/ (Fs/2), Apass);
Hd1 = dfilt.df2 (b, a);
y1=filter (Hd1, y0);
Subplot (3, 1, 3), plot (y1), title ('ECG signal with power line noise Removed'), grid on
`

Contribution:

2018-EE-503 (Research + Report writing)


2018-EE-506 (MATLAB work + Research)

You might also like