You are on page 1of 5

International Journal of Engineering Trends and Technology (IJETT) Volume 4 Issue 10 - Oct 2013

ISSN: 2231-5381 http://www.ijettjournal.org Page 4624




Design And Implementation Of Height Adjustable
Sine (Has) Window-Based Fir Filter For
Removing Powerline Noise In ECG Signal

Mbachu C. B
1
. and Anumaka M. C
2
.


1
Department of Electrical and Electronic Engineering, Anambra State
University, Uli, Nigeria

2
Department of Electrical and Electronic Engineering, Imo State University,
Owerri, Nigeria


.

AbstractAn electrocardiogram (ECG) is a simple
but vital test which records the rhythm and electrical
activity of the heart. The appearance of the recorded
ECG signal tells doctors if a patient is suffering from
any heart disease such as enlargement or thickening
of the heart, or if a heart attack is likely to occur or
had earlier occurred. ECG signal is contaminated
with other signals including powerline noise which
must be filtered off, otherwise the recorded ECG
signal will convey information that is not correct. In
this paper a narrow band stop digital filter is designed
with adjustable height sine (HAS) window for
suppression of powerline noise in ECG signals.
Matlab is used to generate the signal and noise as
well as observe and record the results.

Keywords: HAS Window, ECG, Powerline noise,
band stop filter

1. Introduction

There are various filter types that can be used to
remove powerline noise in ECG signal. The filter
may involve IIR, FIR and adaptive filters and each
has its own advantages and disadvantages. FIR filter
has a finite impulse response and therefore always
stable but its number of coefficients is very large
which implies larger memory space for the storage of
the coefficients and higher computation time. On the
other hand IIR filter has less number of coefficients
but can be unstable sometimes due to feedback loops.
In FIR filters windows are used to weight them
so as to prevent oscillations due to sudden truncation.
Different windows have been used by different
researchers. In [1] Kadam Geeta and Bhaskar P. C.
did a good comparison of equiripple filter and FIR
filters implemented with Kaiser, Rectangular,
Hanning, Hamming, Blackman and Bartlet windows
in suppression of powerline noise in
electrocardiographic signals. Chavan Mahesh S. et
al.[2] and Mbachu C. B. et al. [3] carried out the
design and implementation of FIR digital filters for
processing ECG signal with rectangular window in
their works. Chinchkhede K. D. et al.[4] in
implementing FIR filter for enhancement of ECG
compared the performances of FIR filters designed
with Gaussian, Kaiser, Blackman and Blackman
Harris windows. In [5] Chavan Mahesh S. et al.
determined the effectiveness of removing powerline-
noise by FIR digital filters designed and implemented
with rectangular, Hanning, Hamming and Kaiser
windows. In [6] Islam M. K. et al. in their design of
FIR filters for processing ECG weighted the filter
with Kaiser Window. In [7] Mbachu C. B. et al.
equally weighted the FIR filters they designed and
implemented for filtration of ECG with Kaiser
Window. The authors in [8] also applied Kaiser
Window in designing and implementing low pass,
high pass and notch digital filters for ECG
processing. Renumadhavi C. H. et al. in [9] in using
different types of filters to remove powerline noise in
ECG included digital FIR filters designed with
Hamming and Bartlett windows. In [10] Van Alste J.
A. and Schilder T. S. investigated the performance of
FIR digital filter designed with Kasier window in the
removal of baseline wander and powerline noises in
ECG. In these works or any other known work, no
researcher has worked with height-adjustable sine
(HAS) window. In this paper, designing a digital FIR
narrow band stop filter for removing 50Hz powerline
noise using HAS window is proposed.

International Journal of Engineering Trends and Technology (IJETT) Volume 4 Issue 10 - Oct 2013
ISSN: 2231-5381 http://www.ijettjournal.org Page 4625


2. HAS Window Function

The diagram of HAS window function is shown in
fig. 1 below while the mathematical model is
represented as equation (1), where L is the order of
the filter and is the height determining quantity and
varies from 0 to 1.

















Fig. 1: HAS Window Function

( )
( )
( ) ( )
(
(
(
(
(

s s
(


+
s s
(


+
=

L k
L
L
k L
L
k k
L
k w
2
1 sin 2
sin
2
0 ,
1 sin 2
sin
1
1

(1)



3. Design of Digital Narrow Band
Stop Filter With HAS Window

A Sine window when it is used to weight
symmetrical narrow band stop digital FIR filter for
suppression of powerline noise in ECG may
introduce oscillations due to the fact that it pulls
down the impulse response of the filter to zero at
both extremes of beginning and end. The HAS
window may improve this effect because it pulls up
the two extremes to a value of o not equal to zero.
Recall that o varies between 0 and1. For the narrow
band stop filter targeted at 50Hz powerline noise
filtration in ECG, o is made to be about 0.02 value.
The order of filter here is L =100 which implies that
the number of samples or filter taps is M =L +1 =
101. With this values (1) transforms to (2).
1 o =1 0.02 =0.98
u =sin
-1
(1 o) =Sin
-1
0.98 =78.522
0

( )
100
522 . 78 2
L
1 sin 2
1

=
o
=


0
5704 . 1 =
,
where is the angle covered by the curve AC in fig.
1. Substituting = 1.54704
0
in (1) gives
( ) 50 0 , 5704 . 1 sin 02 . 0
1
s s + = k k k w
( ) ( ) 100 50 , 5704 . 1 100 sin 02 . 0 2 s s + = k k k w

Combining w
1
(k) and w
2
(k) yields
( )
( )
( ) ( )
(

s s +
s s +
=
100 k 50 , 5704 . 1 k 100 sin 02 . 0
50 k 0 , k 5704 . 1 sin 02 . 0
k w
(2)
If the window of (2) is used in designing and
implementing a narrow band stop digital FIR filter
for powerline noise removal in ECG signal, the
impulse, magnitude and phase responses of the filter
are shown in figure 2, 3 and 4, respectively.

Fig. 2: Impulse Response of the Filter



Fig. 3: Magnitude Response of the Filter

0 10 20 30 40 50 60 70 80 90 100
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-25
-20
-15
-10
-5
0
5
D
C
A
B
W(k)
1
0

L
2
L

k

International Journal of Engineering Trends and Technology (IJETT) Volume 4 Issue 10 - Oct 2013
ISSN: 2231-5381 http://www.ijettjournal.org Page 4626



Fig. 4: Phase Response of the Filter


3. Results

A noise-free normal ECG signal of 3.5mV value
generated by matlab is shown in fig 5. The generated
ECG signal is corrupt with 50Hz powerline of 0.1mV
and the resulting signal is recorded in fig 6. The
frequency spectrum of the corrupt ECG is depicted in
fig 7. From fig 7 the average power of the corrupt
ECG signal at 50Hz before the application of the
digital filter is about +4.2dB. The corrupt ECG is
filtered with the designed digital filter and the output
recorded and depicted in fig. 8. The frequency
response of the filtered ECG is presented in Fig 9.
Form fig. 9 the average power of the filtered ECG at
50Hz is brought down to about -19dB, which in
effect means that the implemented narrow band stop
FIR filter has removed the 50Hz powerline noise in
the ECG signal.

The corrupt ECG signal of fig. 6 is applied to an FIR
adaptive notch filter as a way of comparing the
performances of FIR notch filter designed with HAS
window and adaptive notch filter in removing
powerline interference in ECG signals. The
adaptively filtered ECG signal is recorded in fig. 10
while the frequency spectrum is shown in fig. 11.
From fig. 11 the average power of the ECG signal
filtered with adaptive notch filter at 50Hz is further
reduced to -34.2dB. Note that 50Hz here
corresponds to 0.1rad in the normalized frequency
scale.



Fig. 5: Normal Noise-Free ECG Signal



Fig. 6: ECG Corrupt with 50Hz Powerline







Fig. 7: Frequency Response of ECG
Corrupt with 50Hz Powerline
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-160
-140
-120
-100
-80
-60
-40
-20
0
0 500 1000 1500 2000 2500 3000
-3
-2
-1
0
1
2
3
4
0 500 1000 1500 2000 2500 3000
-3
-2
-1
0
1
2
3
4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-100
-80
-60
-40
-20
0
20
Normalized Frequency (trad/sample)
P
o
w
e
r
/
f
r
e
q
u
e
n
c
y

(
d
B
/
r
a
d
/
s
a
m
p
l
e
)
PeriodogramPower Spectral Density Estimate
International Journal of Engineering Trends and Technology (IJETT) Volume 4 Issue 10 - Oct 2013
ISSN: 2231-5381 http://www.ijettjournal.org Page 4627




Fig. 8: Filtered ECG



Fig. 9: Frequency Response of Filtered
ECG








Fig. 10: Adaptively Filtered ECG
Signal




Fig. 11: Frequency Spectrum of
Adaptively Filtered ECG Signal


4. Conclusion

The impulse response is indicating stability of the
filter. The ripples in the magnitude response of the
filter decay quickly which suggests filter stability.
The phase response is linear and as such the filtered
ECG signal will not experience any differential phase
shift due to the filter.
The HAS window-based filter filters off the 50Hz
powerline interference in the corrupt ECG signal of
fig. 6 as shown in fig.8. Comparing the performance
of the HAS filter with that of adaptive filter, as can
be deduced from figures 10 and 11 shows that the
adaptive filter is better in ECG processing with a
view to removing powerline interference.



REFERENCES

[1] Kadam Geeta and Bhaskar P. C., Reduction of
Powerline Interference in ECG Signal Using FIR
Filter, International Journal of Computational
Engineering Research (IJCER), Vol. 2, No. 2,
Pp. 314 319, 2012.
[2] Chavan Manesh S, Agarwala R. A. and Uplane
M. D., Interference Reduction in ECG using
Digital FIR Filters Based on Rectangular
Window, WSEAS Transactions on Signal
Processing, Vol. 4, Issue 5, Pp. 340 349, 2008.
[3] Mbachu C. B, Idigo Victor, Ifeagwu Emmanuel
and Nsionu I. I., Filtration of Artitacts in ECG
Signal Using Rectangular-Based Digital Filters,
International Journal of Computer Science Issues
(IJCSI), Vol. 8, Issue 5, Pp. 279 285, 2011.

0 500 1000 1500 2000 2500 3000
-3
-2
-1
0
1
2
3
4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-100
-80
-60
-40
-20
0
20
Normalized Frequency (trad/sample)
P
o
w
e
r
/
f
r
e
q
u
e
n
c
y

(
d
B
/
r
a
d
/
s
a
m
p
l
e
)
PeriodogramPower Spectral Density Estimate
0 500 1000 1500 2000 2500 3000
-4
-3
-2
-1
0
1
2
3
4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-100
-80
-60
-40
-20
0
20
Normalized Frequency (trad/sample)
P
o
w
e
r
/
f
r
e
q
u
e
n
c
y

(
d
B
/
r
a
d
/
s
a
m
p
l
e
)
PeriodogramPower Spectral Density Estimate
International Journal of Engineering Trends and Technology (IJETT) Volume 4 Issue 10 - Oct 2013
ISSN: 2231-5381 http://www.ijettjournal.org Page 4628

[4] Chinchkhede K. D., Yadav Govind Sharan,
Hirekhan S. R. and Solanke D. R., On the
Implementation of FIR Filters with various
windows for Enhancement of ECG Signal,
International Journal of Engineering Science and
Technology (IJEST), Vol. 3, No. 3, Pp. 2031
2040, 2011.
[5] Chavan Mahesh S., Agarwala R. A. and Uplane
M. D., Design and Implementation of Digital
FIR Equiripple Notch Filter on ECG Signal for
Removal of Powerline Interference, WSEAS
Transactions on Signal Processing, Vol. 4, No. 4,
Pp. 221 230, 2008
[6] Islam M. K., Haque A. N. M. M., Tangim G.,
Ahammad T. and Khondokar M. R. H., Study
and Analysis of ECG Signal using Matlab
and Labview as Effecctive Tools, International
Journal of Computers and Electrical
Engineering, Vol. 4, No. 3. Pp. 404 408, 2012.
[7] Mbachu C. B., Onoh G. N., Idigo V. E., Ifeagwu
E. N. and Nnebe S. U., Processing ECG Signal
with Kaiser Window-Based FIR Digital Filters,
International Journal of Engineering, Science
and Technology (IJEST), Vol. 3 No. 8, Pp. 6775
6783, 2011.
[8] Chavan Mahesh S., Agarwala R. A. and Uplane
M. D., Use of Kaiser Window for ECG
Processing, Proceedings of the 5
th
WSEAS
International Conference on Signal Processing,
Robotic and Automation, Madrid, Spain, Pp. 1
5, 2008.
[9] Renumadhavi C. H., Kumar S. Madhava, Ananth
A. G. and Srinivasan Nirupama A new
approach for evaluating SNR of ECG Signals
and its implementation, Proceedings of the 6
th

WSEAS International Conference on Simulation,
Modeling and Optimization, Lisbon, Portugal,
Pp. 202 205, 2006.
[10] Van Alste J. A. and Schilder T. S., Removal of
Base-line Wander and Powerline Interference
from the ECG by an Efficient FIR Filter with a
Reduced Number of Taps, IEEE Transactions
on Biomedical Engineering, Vol. 32, No. 12, pp.
1052 1062, 1985.