You are on page 1of 6

International Journal on Computing, Communications and Systems (IJCCS)

ISSN:2277-6699 Vol-4,Issue-2 (December-2015)

Suppression of noise from Electrocardiogram (ECG) signal


using Adaptive filtering algorithm
N.GEETHA
Department of Electronics and Communication Engineering
JNTUK, University College of Engineering,
Vizianagaram, India
geetha.flawless@gmail.com

DR.B.T.KRISHNA
Department of Electronics and Communication Engineering
JNTUK, University College of Engineering,
Vizianagaram, India
tkbattula@gmail.com

AbstractECG is an acronym for Electro Cardio Gram and is


the recording of the electrical activity of heart muscle. The
ECG signal gets contaminated by noise, which is caused by
Power line interference, Baseline wandering, External
Electromagnetic fields, Random body movements, Muscle
noise, Respiration, Poor contact of electrodes, equipment
etc.This causes an error in the results of the patients
condition. Hence suppression of noise in ECG is mandatory. In
this paper, the performance of Least Mean Square (LMS), Sign
Data Least Mean Square (SDLMS),Sign Error Least Mean
Square (SELMS),Sign Sign Least Mean Square (SSLMS),RLS
and NLMS adaptive filters, Wavelet, Savitzky-Golay filters are
analyzed to remove noise from ECG Signal. Signal to Noise
ratio (SNR), Percentage Root Mean square (PRD) and
Normalized Maximum error values are calculated and
compared among these filters and the relevant graphs are
plotted using Matlab.

filter coefficients change by themselves. Such type of filters are


known as Adaptive filters. Adaptive filters are non-linear filters
whose filter coefficients change continuously [4].

Keywords- :ECG signal,Least Mean Square


Wavelet,Savitzky-Golay, Normalized Maximum error.

LMS algorithm minimizes the sum of the squares of the difference


between the desired signal and model filter output. The LMS
algorithm equation:

1.

algorithm,

INTRODUCTION

In this paper, the adaptive filtering methods namely LMS,


SDLMS, SELMS, SSLMS, RLSfrom [3],NLMS from [4],
Wavelets using Universal and Level-Dependent thresholding and
Savitzky-golay [1] filters are presented. These methods are applied
for ECG denoising and a comparison between their performancesis
made based on the difference between the original ECG (without
noise) and the denoised version after filtering the noise.
The paper is organized as follows. The algorithms used are
discussed in Section 2. The present work is discussed in Section 3.
Finally results and discussions are presented in Section 4.
2.

ALGORITHMS

2.1 Least Mean Square (LMS) adaptive filtering algorithm:

W(i)=w(i)+2e(m)X(m-i)

for i=0,1,..N-1 (1)

Electrocardiogram (ECG) signal indicates the electrical activity of


heart muscle in a graphical sense. This signal is used to analyze the
condition of the patient. The ECG signal amplitude is in the order
of 1mv and its frequency range is 0 to 100 hertz[1-2]. The ECG
can be normal sinus rhythm, Tachycardia or Bradycardia. Normal
heart rate of a person is 72 beats per minute (BPM). Tachycardia is
a heart rate that exceeds the normal range of the heartbeat. A
resting heart rate over 100 BPM is accepted as tachycardia &
Bradycardia is the resting heart rate of under60 BPM. A heart rate
below 40BPM indicatesan exact Bradycardia. An ECG signal
should be presented as clean as possible for the accurate decisions
by the physicians. But the ECG signal gets contaminated by noise,
which is caused by: Power line interference, Baseline wandering,
External Electromagnetic fields, Random body movements,
Muscle noise, Respiration, Poor contact of electrodes, equipment
[2] and etc.This causes an error in the results of thepatients
condition. Hence the suppression of the interfered noise is an
important issue.

where is the step size or adaptation constant.

In general, digital filters are used to eliminate noise from ECG


signal. But ECG is a non- stationary signal as the human behavior
is not exactly known depending on the time[3-4]. Hence, it is
difficult to apply filters with fixed coefficients to reduce biomedical signal noises. So, there is a need to design filters whose

2.4 Sign SignLeast Mean Square (SSLMS) adaptive filtering


algorithm:
This algorithm is obtained by replacing both the data vector X(m-i)
and error value e(m) from the LMS algorithm with their sign
values i.e. nothing but the combination of both SDLMS and

24

2.2Sign Data Least Mean Square (SDLMS) adaptive filtering


algorithm:
SDLMS algorithm is obtained by replacing the data vector X(m-i)
from the LMS algorithm with its sign value. Each filter coefficient
is updatedusing the following equation:
W(i)=w(i)+2e(m)sign(X(m-i))
for i=0,1,..N-1 (2)
SDLMS can also be called as Signed-Regressor LMS algorithm.
2.3 Sign Error Least Mean Square (SELMS) adaptive filtering
algorithm:
This algorithm is obtained by replacing e(m) from the LMS
algorithm with its sign value. The filter coefficient update is
achieved by:
W(i)=w(i)+2sign(e(m)) X(m-i)for i=0,1,..N-1 (3)

MRCET-UGC AUTONOMOUS

International Journal on Computing, Communications and Systems (IJCCS)


ISSN:2277-6699 Vol-4,Issue-2 (December-2015)
SELMS
This
leads
to
the
following
recursion:
W(i)=w(i)+2sign(e(m))sign(X(m-i))for i=0,1,..N-1 (4)
2.5Recursive Least Square (RLS) adaptive filtering algorithm:
The Recursive least squares (RLS) adaptive filter recursively finds
the filter coefficients which minimizes a weighted linear least
squares cost function relating to the input signals. In this algorithm
the filter tap weight vector is updated using Eq.
+1 = + (m) . (m) (5)
where e(m) is the difference between the desired response d(m)
and the output y(m).
2.6 Normalized Least Mean Square (NLMS) adaptive filtering
algorithm:
The NLMS algorithm is a modified version of the LMS algorithm.
The NLMS algorithm updates its coefficients by using the below
equation
W(m+1)=W(m)+.

( )
+( )2

.e(m)

Which can be also be rewritten as


W(m+1)=W(m)+(m).X(m).e(m) (6)
Where (m)=

+( )2

The Adaptive filter length is chosen as 32 tabs for LMS, RLS and
NLMS and the step-size for LMS and NLMS is chosen as 0.0276
whereas the size of the inverse correlation matrix is 32 and the
forgetting factor is 1.The combination of the mother wavelet
which is considered to be sym12 and denoising by both universal
and interval-dependent thresholds using level3 gives the best
performance. The frame-sizefor the Savitzky-Golayfilter is
considered to be 31 and the polynomial order is chosen to be 8.
4.

Original ECG from [7] plotted in MATLAB is shown in Figure 1.


Noise added to ECG in Figure 2, Noisy ECG of SNR 25db is
shown in Figure 3 and the denoised versions of the Noisy ECG at a
single SNR value of 25db for LMS,RLS, NLMS, Universal
thresholding, Level-Dependent thresholding, Savitzky-Golay
filtering techniques,SDLMS, SELMS, SSLMS, are shown in
Figures4 to 12.Noisy ECG signals valued from 5db to 40db of
SNR versus Estimated Normalized PRD, Estimated SNR and
Normalized Max error from 5db to 40db of SNRcorrespondingly
are plotted in MATLAB and are as shown in Figures 13,14 and
15.In this paper, comparisons among the denoising algorithms are
made based on their Signal to Noise ratio (SNR), Percentage Root
Mean Square (PRD) and Normalized Max Error values.
= 10 log
[

The NLMS algorithm is same as the standard LMS algorithm


except the time-varying step size parameter(m). 2.7 Wavelet
A Wavelet is an oscillation with its amplitude which begins at
zero, increases, and then decreases back to zero. In wavelet
analysis, the signal is broken into shifted and scaled versions of the
original (or mother) wavelet. The continuous wavelet transform
(CWT) gives detailed time-scale representation.Mallats
algorithm:

DISCUSSION OF RESULTS

PRD= 100

2
=1 ()

2
[

()]
=1

(8)

2
=1 [ ()]

2
=1 ()

(9)

max = max e i r(i) (10)


Where x(i) is the noisy ECG and e(i) is the denoised version of
noisy ECG and r(i) is the clean ECG.

2.8 Savitzky-Golay Filter


Savitzky and Golay [8] proposed a data smoothing method based
on local least-squares polynomial approximation. The lowpass
filters resulted by this method are known as Savitzky-Golay (S-G)
filters. An appropriate vector a=[0 , 1 , . ] must be selected
which can approximate a group of 2M+1 noisy samples x[n] by the

polynomial p(n)=
=0 so that the error
=

= (

)2

(7)

is minimized. The input has M samples at each side of the central


point
which
can
be
understood
by
x=[ , +1 , . 1 , 0 , 1 , . ] . The output samples y[n]
for each input sets x are evaluated using the discrete convolution
[n]=
= [ ]where the finite impulse response h is
equivalent to the least-squares polynomial approximation.
3.

Figure 1: Original ECG.

CURRENT WORK

ECG signals from [7] are normalized and are contaminated with
different levels of Adaptive White Gaussian Noise (AWGN).
Using the above mentioned techniques, the original signal ECG is
recovered from its contaminated version. Depending on their
respective operation parameters, each methods accuracy of
performance is measured and a comparison among the methods is
made.

25

Figure 2: Noise added to ECG.


MRCET-UGC AUTONOMOUS

International Journal on Computing, Communications and Systems (IJCCS)


ISSN:2277-6699 Vol-4,Issue-2 (December-2015)

Figure 3: Noisy ECG.

Figure 6:Filtered ECG by NLMS filtering algorithm.

Figure 4: Filtered ECG by LMS filtering algorithm.

Figure7 Filtered ECG by Universal thresholdingwavelet.

Figure 5:Filtered ECG by RLS filtering algorithm.


Figure 8 Filtered ECG by Level-Dependent thresholding wavelet.

26

MRCET-UGC AUTONOMOUS

International Journal on Computing, Communications and Systems (IJCCS)


ISSN:2277-6699 Vol-4,Issue-2 (December-2015)

Figure 9 Filtered ECG by Savitzky-Golay filtering algorithm.

Figure 12:Filtered ECG by SSLMS filtering algorithm.

Figure 10:Filtered ECG by SDLMS filtering algorithm.


Figure 13: SNR versus Estimated Normalized PRD.

Figure 11:Filtered ECG by SELMS filtering algorithm.


Figure 14: SNR versus Estimated SNR.

27

MRCET-UGC AUTONOMOUS

International Journal on Computing, Communications and Systems (IJCCS)


ISSN:2277-6699 Vol-4,Issue-2 (December-2015)
Table.1.Tabular form for Estimated SNR values:

Figure 15: SNR versus Normalized Max Error.


Therefore the results obtained by the above filtering processes have
been plotted by considering their best results. The results show that
the SDLMS, SELMS and SSLMS perform better than the
conventional LMS algorithm. Interval-Dependent thresholding
wavelet shows somewhat better performance than Universal
thresholding wavelet and Savitzky-Golay filter. RLS shows better
performance than LMS and NLMS. Overall performance shown by
SELMS and SSLMS seems better than the remaining filters. The
corresponding tabular values are shown in Table.1,2 and 3.
5.

REFERENCES

[1]
Mohammed AlMahamdy
, H. Bryan Riley
PhD,
Performance Study of Different Denoising Methods for ECG
Signals , Science Direct, Procedia Computer Science 37,pp.325332,2014.
[2] N. V Thakor and Y. S. Zhu, Applications of adaptive filtering
to ECG analysis: noise cancellation and arrhythmia detection.,
IEEE Trans.
Biomed. Eng., vol. 38, no. 8, pp. 78594, Aug. 1991.
[3] G. M. S. Sajjad, H. Rahman, A. K. Dey, A. M. Biswas, Z.
Islam, and A. K. M. J. Hoque, Performance Comparison of
Modified LMS and RLS Algorithms in Denoising of ECG
Signals, Int. J. Eng. Technol., vol. 2, no. 3, pp. 466468, 2012.
[4] C. Chandrakar and M. K. Kowar, Denoising ECG Signals
Using Adaptive Filter Algorithm, Int. J. Soft Comput.Eng., vol.2,
no. 1, pp.
120123, 2012.
[5] S.G. Mallat, A theory for multiresolution signal
decomposition: the wavelet representation, IEEE Trans. Pattern
Anal. Mach. Intell., vol.11, no. 7, pp. 674693, Jul. 1989.
[6] D. L. Donoho and I. M. Johnstone, Adapting to Unknown
Smoothness via Wavelet Shrinkage, J. Am. Stat. Assoc., vol. 90,
no. 432, p.1200, Dec. 1995.
[7]
PhysioNet.
[Online].
Available:
http://www.physionet.org/cgi-bin/atm/ATM. [Accessed: 27-Mar2014].
[8] A. Savitzky and M. J. E. Golay, Soothing and Differentiation
of Data by Simplified Least Squares Procedures, Analytical
Chemistry, vol. 36, pp.1627-1639, 1964.

28

0.5218
0.6066
57.0465
50.4474
3.6716
1.7993
14.7413
10.4555

SNR
for
10db
1.9899
3.1955
66.4896
53.6875
8.8346
4.7793
19.7300
15.0054

SNR
for
15db
6.5282
7.5064
76.2015
59.9665
12.5272
21.7802
24.5372
20.1853

SNR
for
20db
9.8315
11.3447
80.2482
60.0622
22.0533
26.4430
29.5552
24.2712

SNR
for
25db
17.1430
12.1420
86.0394
65.3518
29.8069
39.2936
34.6194
30.1345

SNR
for
30db
25.9793
18.3780
90.9153
70.4217
41.4000
46.2943
38.9217
34.9086

13.3688

17.4942

For
=0.03

SNR
for 5db

LMS
SDLMS
SELMS
SSLMS
NLMS
RLS
ID-WT
UT-WL
SGOLAY
For
=0.008

SNR
for 5db

LMS
SDLMS
SELMS
SSLMS
NLMS

1.4479
5.7588
63.6624
60.8378
9.6101

For
=0.01

SNR
for 5db

LMS
SDLMS
SELMS
SSLMS
NLMS

0.0655
2.8084
61.3831
54.1691
8.1865

For
=0.05

SNR
for 5db

LMS
SDLMS
SELMS
SSLMS
NLMS

14.5560
14.3771
47.7508
43.6698
1.3271

35.1769
26.2180
91.0740
79.6854
42.5355
50.3577
43.5582
39.7430

SNR
for
40db
42.4576
32.3423
92.9676
81.4093
53.6350
55.2501
48.3335
44.2887

SNR for
35db

22.2771

27.2016

32.1815

37.0215

42.2858

46.9634

SNR
for
10db
3.9464
8.3084
74.4719
70.1487
15.7217

SNR
for
15db
7.4914
11.0487
79.3416
73.6506
22.0544

SNR
for
20db
16.0305
14.6248
86.6976
75.2907
27.7391

SNR
for
25db
20.3105
17.7968
92.1688
82.2462
32.2852

SNR
for
30db
27.5144
26.7593
94.9097
89.1761
43.2468

SNR
for
35db
36.4731
30.8709
93.1341
90.1409
55.4947

SNR
for
40db
53.5575
38.6265
95.9254
92.9701
67.7423

SNR
for
10db
2.3301
7.7131
72.6039
61.2801
13.9281

SNR
for
15db
8.0572
9.0123
78.9969
68.6835
18.3241

SNR
for
20db
15.4858
15.2856
86.1471
71.5137
27.0447

SNR
for
25db
21.4018
16.9796
91.1389
76.4454
35.4907

SNR
for
30db
25.0089
19.9606
94.0999
85.6523
42.2770

SNR
for
35db
34.7601
29.8215
92.8469
86.8617
50.8021

SNR
for
40db
50.7360
37.0868
93.0265
89.3271
62.3710

SNR
for
10db

SNR
for
15db

SNR
for
20db

SNR
for
25db

SNR
for
30db

SNR
for
35db

SNR
for
40db

-1.9651

3.0731

9.4584

16.4866

22.6843

32.0494

39.7390

-3.4323

2.5995

7.5176

11.8133

14.0219

16.3840

22.0818

63.0874
48.5956
8.5520

72.9719
55.2026
12.0920

74.7310
60.0459
22.9047

85.7027
62.7697
29.8573

86.9264
63.0694
41.1920

88.7173
71.2127
42.4779

90.1188
72.1859
54.8769

SNR for
30db

SNR for
35db

SNR for
40db

1.7425
4.8876
2.8040e004
0.0102
0.7470
0.1075
1.6687
1.8501

0.7535
1.8060
5.2584e005
0.0084
0.2082
0.0547
0.9642
1.0742

Table.2.Tabulated form for estimated PRD values:


SNR
SNR
SNR
For
SNR
for
for
for
=0.03
for 5db
10db
15db
20db
96.1915
79.5256
47.1607
32.2422
LMS
99.1004
69.2189
42.1387
27.0874
SDLMS

SNR
for
25db
13.8947
24.7117

SELMS

0.1426

0.0465

0.0141

0.0079

0.0040

SSLMS
NLMS
RLS
ID-WT
UT-WL
SGOLAY

0.3007
65.5252
40.2300
45.2819
51.7461

0.2618
36.1628
36.4081
28.0875
31.2602

0.1011
23.6401
33.1446
16.7440
17.6543

0.0985
7.8943
32.7613
9.3151
10.4789

0.0543
3.2330
4.0841
5.2266
5.6818

5.0236
12.0531
3.9459e004
0.0303
0.8512
0.4849
2.9564
3.3573

44.0825

27.4392

15.7061

8.9192

5.0148

2.8750

1.5840

0.9203

For
=0.008

SNR
for 5db

SNR
for
20db
15.7938
18.5683

SNR
for
25db
9.6492
12.8869

SNR for
35db

SNR for
40db

84.6465
51.5303

SNR
for
15db
42.2116
28.0264

SNR for
30db

LMS
SDLMS

SNR
for
10db
63.4873
38.4201

SELMS

0.0578

0.0126

0.0065

0.0020

0.0010

SSLMS
NLMS

0.0846
33.0725

0.0267
16.3651

0.0178
7.8929

0.0173
4.1017

0.0070
2.4304

4.2102
4.5924
2.1129e004
0.0034
0.6879

1.5010
2.8607
2.1072e005
0.0031
0.1679

0.2099
1.1713
1.2853e005
0.0010
0.0411

For
=0.01

SNR
for 5db

SNR
for
20db
16.8157
17.2080

SNR for
30db

SNR for
35db

SNR for
40db

99.2501
72.3733

SNR
for
15db
39.5492
35.4304

SNR for
25db

LMS
SDLMS

SNR
for
10db
76.4717
41.1467

SELMS

0.0407

0.0211

0.0070

0.0017

SSLMS
NLMS

0.1900
38.9639

0.0839
20.1200

0.0371
12.1270

0.0268
4.4433

8.5092
14.1585
9.4301e004
0.0152
1.6802

5.6174
10.0456
1.3388e004
0.0053
0.7696

1.8282
3.2280
9.7322e005
0.0043
0.2885

0.2906
1.3985
5.1615e005
0.0035
0.0762

For
=0.05

SNR for
5db

SNR for
10db

SNR for
35db

SNR for
40db

LMS
SDLMS

550.6379
429.0053

SELMS
SSLMS
NLMS

2.4977
15.1634
7.2887e004
0.0276
0.7519

1.0305
7.8688
1.4860e004
0.0245
0.1804

125.3874
148.4613

SNR
for
15db
70.2007
74.1348

SNR
for
20db
33.6574
42.0845

SNR
for
25db
14.9855
25.6645

SNR
for
30db
7.3415
19.9025

0.4057

0.0703

0.0217

0.0170

0.0050

0.0020

0.6573
98.2870

0.3732
37.3590

0.1747
24.8541

0.0993
7.1580

0.0723
3.2149

0.0704
0.8718

MRCET-UGC AUTONOMOUS

International Journal on Computing, Communications and Systems (IJCCS)


ISSN:2277-6699 Vol-4,Issue-2 (December-2015)
Table.3.Tabulated form for Normalized Maximum error values:
SNR
SNR
SNR
For
SNR
for
for
for
=0.03
for 5db
10db
15db
20db
1.6986
1.6098
1.4918
1.1005
LMS
1.6582
1.4203
1.2305
1.0568
SDLMS
0.6671
0.4586
0.3258
0.1500
SELMS
0.6482
0.5482
0.4192
0.3819
SSLMS
1.4831
1.3837
1.3500
0.7971
NLMS
1.3984
1.3414
1.1383
0.8073
RLS
1.3325
1.0739
0.5420
0.3619
ID-WT
1.4991
1.2057
0.7943
0.5294
UT-WL
S1.4129
1.1057
0.5784
0.3789
GOLAY

For
=0.008
LMS
SDLMS
SELMS
SSLMS
NLMS

SNR
for
5db
1.6396
1.5237
0.6015
0.6125
1.2586

SNR
for
10db
1.5487
1.4038
0.4205
0.5147
1.1578

SNR
for
15db
1.4351
1.1948
0.3148
0.3548
1.1089

SNR
for
20db
0.9075
0.8428
0.1289
0.2248
0.6418

SNR
for
25db
0.6363
0.5472
0.0192
0.2186
0.4002
0.5927
0.3021
0.3212

SNR
for
30db
0.3868
0.3589
0.0152
0.1462
0.2236
0.2295
0.1992
0.2910

SNR
for
35db
0.1595
0.1304
0.0049
0.0528
0.1071
0.1608
0.1339
0.1263

SNR
for
40db
0.1164
0.1000
0.0037
0.0211
0.0567
0.0295
0.0048
0.1012

0.3129

0.2910

0.1923

0.1012

SNR
for
25db
0.5720
0.4953
0.0100
0.1958
0.3856

SNR
for
30db
0.3810
0.2941
0.0086
0.1025
0.2048

SNR
for
35db
0.1352
0.1258
0.0024
0.0256
0.0864

SNR
for
40db
0.1023
0.0942
0.0014
0.0123
0.0419

29

For
=0.01
LMS
SDLMS
SELMS
SSLMS
NLMS
For
=0.05
LMS
SDLMS
SELMS
SSLMS
NLMS

SNR
for
5db
1.6429
1.5976
0.6523
0.6385
1.3645

SNR
for
10db
1.6001
1.4100
0.4419
0.5316
1.2359

SNR
for
15db
1.4826
1.2015
0.3209
0.3549
1.2469

SNR
for
20db
0.9847
1.0499
0.1359
0.2986
0.6579

SNR
for
25db
0.6015
0.5403
0.0159
0.2016
0.3985

SNR
for
30db
0.3826
0.2999
0.0016
0.1238
0.2136

SNR
for
35db
0.1397
0.1259
0.0039
0.0489
0.0899

SNR
for
40db
0.1103
0.1256
0.0985
0.0197
0.0501

SNR
for
5db
1.7286
1.6651
0.6961
0.6626
1.5201

SNR
for
10db
1.6942
1.5713
0.6482
0.7328
1.4620

SNR
for
15db
1.5781
1.3548
0.6842
0.7089
1.4123

SNR
for
20db
1.3580
1.2039
0.3642
0.4982
0.8111

SNR
for
25db
0.7958
0.6416
0.0985
0.2582
0.5239

SNR
for
30db
0.4716
0.4529
0.0486
0.1550
0.3845

SNR
for
35db
0.3584
0.2364
0.0098
0.0622
0.2359

SNR
for
40db
0.2658
0.1486
0.0049
0.0291
0.1283

MRCET-UGC AUTONOMOUS