You are on page 1of 9

Available online at www.sciencedirect.

com
Available online at www.sciencedirect.com
ScienceDirect
ScienceDirect
Procediaonline
Available Computer
at Science 00 (2019) 000–000
www.sciencedirect.com
Procedia Computer Science 00 (2019) 000–000 www.elsevier.com/locate/procedia
www.elsevier.com/locate/procedia
ScienceDirect
Procedia Computer Science 171 (2020) 273–281

Third International Conference on Computing and Network Communications (CoCoNet’19)


Third International Conference on Computing and Network Communications (CoCoNet’19)
ECG Denoising Using Wiener Filter and Kalman Filter
ECG Denoising Using Wiener Filter and Kalman Filter
Manju.B.Raa* , Sneha.M.Rbb
a
Manju.B.R * , Sneha.M.R
Associate Professor, Department of Mathematics, Amrita School Of Arts and Science,Amrita Vishwa Vidyapeetham, Amritapuri, Kollam,
a 690525,India
Associate Professor, Department of Mathematics, Amrita School Of Arts and Science,Amrita Vishwa Vidyapeetham, Amritapuri, Kollam,
b
Student, Department of Mathematics, Amrita School Of Arts and Science,Amrita Vishwa Vidyapeetham,Amritapuri, Kollam, 690525,India
690525,India
b
Student, Department of Mathematics, Amrita School Of Arts and Science,Amrita Vishwa Vidyapeetham,Amritapuri, Kollam, 690525,India

Abstract
Abstract
Electrocardiogram (ECG) is a technique of understanding the functioning of heart. Each segment of the ECG signal is significant
for the detection of(ECG)
Electrocardiogram different
is a heart
techniqueproblems. However, some
of understanding noises generally
the functioning of heart.corrupt the ECGofsignal.
Each segment the ECG Wesignal
have isperformed
significanta
research
for on filtersofthat
the detection denoiseheart
different many kinds ofHowever,
problems. noise observed in real generally
some noises ECG signal. Twothe
corrupt filters
ECGaresignal.
implemented
We havetoperformed
remove thea
noises, such
research as Wiener
on filters filter and
that denoise Kalman
many kindsfilter. For observed
of noise better clarity, some
in real ECG performance
signal. Twoparameters
filters are such as MeantoSquare
implemented removeError
the
(MSE), Percentage
noises, such as Wiener Rootfilter
Meanand Square
KalmanDifference
filter. For (PRD), Signal some
better clarity, to Noise Ratio (SNR),
performance Power
parameters Spectral
such as MeanDensity
Square(PSD),
Error
Spectrogram,
(MSE), Magnitude
Percentage Root spectrum
Mean Square are used to compare
Difference the simulation
(PRD), outcomes.
Signal to Noise RatioThe outcomes
(SNR), Powerof the simulation
Spectral Densityshow that
(PSD),
Wiener filter isMagnitude
Spectrogram, an outstanding filter are
spectrum for denoising the ECGthe
used to compare signal.
simulation outcomes. The outcomes of the simulation show that
Wiener filter is an outstanding filter for denoising the ECG signal.
© 2020 The Authors. Published by Elsevier B.V.
©
© 2020
This
2020 The
is an Authors.
open
The accessPublished
Authors. by
by Elsevier
article under
Published B.V.
the CC BY-NC-ND
Elsevier B.V. license (http://creativecommons.org/licenses/by-nc-nd/4.0/)
This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review
This under
is an open responsibility
access article under ofthe
theCCscientific
BY-NC-ND committee
licenseof(http://creativecommons.org/licenses/by-nc-nd/4.0/)
the Third International Conference on Computing and Network
Peer-review under responsibility of the scientific committee of the Third International Conference on Computing and Network
Communications
Peer-review under (CoCoNet’19)
responsibility
Communications (CoCoNet’19). of the scientific committee of the Third International Conference on Computing and Network
Communications (CoCoNet’19)
Keywords: Electrocardiogram (ECG); Denoising; Wiener filter; Kalman filter; SNR; MSE; PSD; Spectrogram, Magnitude Response.
Keywords: Electrocardiogram (ECG); Denoising; Wiener filter; Kalman filter; SNR; MSE; PSD; Spectrogram, Magnitude Response.

1. Introduction
1. Introduction
The depicted portrayal of heart’s electrical activities in time domain is an ECG signal. While recording the ECG
The itdepicted
signal, can be portrayal
interferedofbyheart’s electrical
some noise activities
artifacts. Thesein noise
time domain
artifactsiscreate
an ECG signal.inWhile
changes recording theofECG
the characteristics the
signal, it can leads
signal which be interfered by some
to difficulty noise artifacts.
in diagnosis. So it is These noise
essential artifactsthese
to denoise create changes
noisy ECG in the characteristics of the
signals.
signal which leads to difficulty in diagnosis. So it is essential to denoise these noisy ECG signals.

* Corresponding author. Tel.: +91-944-742-8574; fax: +91-476-289-6178.


E-mail address: manjubr@am.amrita.edu
* Corresponding author. Tel.: +91-944-742-8574; fax: +91-476-289-6178.
E-mail address: manjubr@am.amrita.edu

1877-0509 © 2020 The Authors. Published by Elsevier B.V.


This is an open
1877-0509 access
© 2020 Thearticle under
Authors. the CC BY-NC-ND
Published license (http://creativecommons.org/licenses/by-nc-nd/4.0/)
by Elsevier B.V.
Peer-review under
This is an open responsibility
access of the scientific
article under CC BY-NC-NDcommittee of the
license Third International Conference on Computing and Network Communications
(http://creativecommons.org/licenses/by-nc-nd/4.0/)
(CoCoNet’19)
Peer-review under responsibility of the scientific committee of the Third International Conference on Computing and Network Communications
(CoCoNet’19)

1877-0509 © 2020 The Authors. Published by Elsevier B.V.


This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review under responsibility of the scientific committee of the Third International Conference on Computing and Network
Communications (CoCoNet’19).
10.1016/j.procs.2020.04.029
274 Manju B.R. et al. / Procedia Computer Science 171 (2020) 273–281
2 Author name / Procedia Computer Science 00 (2019) 000–000

There are many kinds of low and high-frequency noises present in ECG signals, which are, Baseline Wander,
Power line interference (PLI), Motion Artifacts, etc. [1].
In recent years, there have been a lot of researches on how one can remove these noises before the actual
detection and classification of diseases. There exist many pre-processing techniques to remove such noises and it
includes various types of adaptive Least Mean Square (LMS) filter, Wiener filter, etc. and non-adaptive filters such
as Notch filters, Infinite Impulse Response (IIR) filters, etc.[2].
PLI (50Hz) seems to be a leading cause of noise in the ECG signal as it is in the ECG signal band (0.05-100Hz),
filtering techniques like Band-stop Discrete Fourier Transform (DFT), Band-stop Infinite Impulse Response (IIR)
and FIR, Kalman filter, Least Mean Square (LMS) filters, Wavelet filters which can recreate functions with linear
and higher polynomials [3] are used and compared based on SNR. It is found that in comparison with Kalman and
Wavelet filtering, FIR and IIR filtering techniques are better due to elevated SNR enhancement, but are not good at
removing white and Gaussian noises. [4]
In [5] different filtering methods like FIR, IIR, Normalized Least Mean Square Algorithm (NLMS) and Discrete
Wavelet Transform (DWT) in which wavelet is sampled discretely [6] Adaptive filters are compared based on the
parameters, SNR, Mean Absolute Error (MAE) Peak Signal To Noise Ratio (PSNR), MSE. Higher SNR and PSNR
values indicate that NLMS is better compared to both DWT, IIR, and FIR. In [7] designed an adaptive filter for
removing noise from the embryo waveform extracted from the mother’s abdominal waveform based on the LMS
algorithm and shown waveform with a reduced noise level. Also deduced relation between step size, rate of
convergence and minimum mean square error (MMSE). In [8], NLMS and LMS are used to eliminate noises such as
muscle artifacts, white noise, PLI, colored noise from contaminated ECG signals. The efficiency of filters was
analysed by both numerical and visual parameters. Numerical parameters were PRD, SNR and visual parameters
were Spectrogram, PSD, Frequency spectrum, Convergence. In terms of these parameters, it is observed that NLMS
has better performance. In [9], the Kalman filter and LMS algorithm are merged to form KLMS and is used to
remove PLI. Results showed that KLMS is better than the usual LMS algorithm in removing PLI because of the low
MSE and high Peak Signal to Noise Ratio (PSNR). Kalman filter is applicable only for linear systems but in
engineering, most of the systems are nonlinear so an advanced version of Kalman filter is introduced known as
extended Kalman filter that can be used for nonlinear systems. This extended Kalman filter is used and has shown
good accuracy and efficiency in removing noise [10]. In [11], the Adaptive LMS algorithm and FIR Weiner filters
have been compared for ECG denoising based on the parameters Power Spectral Density (PSD) and SNR. Results
have shown that the Wiener filter is more efficient in noise removal as it has high SNR value. In this paper we have
used Wiener filter and Kalman filter to remove noises like PLI, white Gaussian noise, baseline wander, Muscle
artifact, composite noise from ECG signal and compared based on different parameters like SNR, MSE, %PRD,
Spectrogram, PSD, Frequency Spectrum.

2. Methodology

The original ECG data is obtained from MIT-BIH arrhythmia database [12].Different sorts of noises and the
original signal are combined using MATLAB Version R2019.Then these signals are denoised using Wiener filter
and Kalman filter.

2.1. Wiener Filter

Wiener filter uses filtering of noisy signal using the spectral properties of desired signal and noise present
considering both as stochastic process with linear property.
This linear filter is applied with coefficients W K on the estimated signal. The input signal, x (n) consist of noise, v
(n),
(1)
The output signal, y (n) should be a close estimate of d (n). So the error signal e (n) should be minimum. The
adaptive algorithm tries to correct the weights WK , so that the mean square error is minimised.
(2)
Manju B.R. et al. / Procedia Computer Science 171 (2020) 273–281 275
Author name / Procedia Computer Science 00 (2019) 000–000 3

Where (3)
A k tap discrete Wiener filter uses the following equation to find the value of y (n)

(4)

The Wiener-Hopf equation, which calculates the optimal weights, is the most significant feature of the Wiener filter.

(5)

Where Wo0 ,Wo1,……..,Wop-1 are the optimum values of tap weights of the filter and rxx is the autocorrelation
function of x(n) and rxd is the cross correlation function between x(n) and d(n).

2.2. Kalman Filter

Kalman filter is divided into two parts [13] Time Update, which calculates the state matrix and the error covariance
matrix, and Measurement Update, the part in which Kalman gain is calculated to correct those predictions. It uses
previous outputs as current input which in turn makes the filter a better one.
To begin the process the initial conditions d 0 (desired signal) and P0 (error covariance) must be introduced into the
algorithm[14].
1) Time update
 Predict the next state

(6)

 Predict the future error covariance

(7)

2) Measurement update
 Calculate Kalman Gain

(8)

 Predicted state is updated using k

(9)

 Update predicted error covariance

(10)

 Proceed the same way and outputs of th state become input for ( +1) th state. Predicted value is denoted
by k, which is the required result of Kalman filter [15], where x k is the measured signal, K is the Kalman
Gain, k is the estimated desired signal, uk denotes control signal, A denote State Transition model,
B denote control input model, Qk denote the covariance of noise in the process, R denote the covariance of
noise in the observation, H denote observation model and PK is the error covariance [16].
4 Author name / Procedia Computer Science 00 (2019) 000–000
276 Manju B.R. et al. / Procedia Computer Science 171 (2020) 273–281

d(n)

FIR (linear y(n) e(n)


d(n)
algorithm) updates
coefficients wk

v(n)

Cost function

Fig. 1. Block diagram of Wiener filter

Initial state Previous state New state (Predicted)


(K-1)

K to K-1

Output of Current become Update with new Measurement


updated state Previous measurement and input
Kalman Gain

Fig. 2. Block diagram of Kalman filter

3. Results

Arrhythmia database of sampling number 3600 is obtained from MIT-BIH [10]. Using MATLAB version R2019
different high and low frequency noises such as PLI, muscle artifact, white Gaussian noise, baseline wander and
composite noise are embedded to the original signal and denoised using Wiener and Kalman filter. Filter outputs are
shown in Fig. 3.
a) b)
Manju B.R. et al. / Procedia Computer Science 171 (2020) 273–281 277
Author name / Procedia Computer Science 00 (2019) 000–000 5

c) d)

e)

Fig. 3. The graphical representation of denoised ECG signal using both Wiener and Kalman filter with different noises a) Gaussian noise;
b) Composite noise; c) Muscle artefact; d) Power line Interference; e) Baseline wander

Different sets of data were taken from MIT-BIH and filtering techniques were applied to each one and values of
parameters like SNR, MSE, and PRD were found out for each data. Table 1 shows that Wiener filter have high SNR
value, low MSE and low PRD compared to Kalman filter. This is true for all kinds of noises.
Table 1. Values of various performance parameters for different noises.

ESTIMATED SIGNAL
Noises Filters SNR MSE PRD
Data Data Data Average Data Data Data Average Data Data Data Average
103 105 121 103 105 121 103 105 121
Gaussian Weiner 5.3435 5.9737 8.2075 6.5083 0.1343 0.1422 0.0649 0.1138 74.384 65.958 45.492 61.94
Kalman 4.4499 5.2543 6.7547 5.4363 0.2171 0.1916 0.1239 0.1775 89.03 74.850 58.439 74.106
Power line Weiner 6.9821 6.4314 9.2382 7.5505 0.0741 0.1255 0.0480 0.08253 57.026 61.694 39.436 52.718
interference
Kalman 4.7660 5.4244 6.4117 5.5340 0.1510 0.1434 0.1242 0.1395 80.89 69.733 60.351 70.324

Muscle Weiner 6.9001 5.3253 8.9682 7.0645 0.0683 0.1971 0.0492 0.1048 56.615 74.624 40.452 57.230
Artifact Kalman 5.3188 5.2970 7.4177 6.0111 0.1292 0.1863 0.0929 0.1361 74.109 74.152 52.178 66.813
Baseline Weiner 4.8079 4.8212 5.8269 5.152 0.1763 0.2270 0.1731 0.1921 82.574 80.823 67.861 77.086
Wander
Kalman 3.3259 3.7172 4.4944 3.8458 0.2758 0.2869 0.3083 0.2903 107.49 96.086 86.603 96.726

Composite Weiner 6.4427 4.9244 7.3395 6.2355 0.0799 0.2337 0.0965 0.1367 60.790 80.254 52.918 64.654
Noise Kalman 4.4744 5.1929 6.3193 5.3288 0.1560 0.1766 0.1462 0.1596 81.546 74.267 62.736 72.849
6 Author name / Procedia Computer Science 00 (2019) 000–000
278 Manju B.R. et al. / Procedia Computer Science 171 (2020) 273–281

To visualise the performance of filters several performance parameters like PSD, Spectrogram, Magnitude
Response, Periodogram are used for removal of PLI.
The PSD is a measure of the power content of the signal versus frequency and helps to identify the filter that works
better [17]. The PSD of noisy signal, Wiener filtered signal, Kalman filtered signal can be obtained from a
periodogram. A periodogram is a graphical representation of a signal in frequency domain. The PSD value of noisy
signal is 1.083dB/Hz but when passed through Wiener and Kalman filter PSD value decreased to -56.43dB/Hz and
9.339dB/Hz respectively is shown in Fig. 4. Table 2 clearly shows the PSD values attained with and without filters.
a) b)

c)

Fig. 4. Graphical representation of PSD of a) Noisy signal, b) Kalman filtered ECG signal, c) Wiener filtered ECG signal

Table 2. Power spectral density estimate


Power spectral density estimate at 50 Hz in dB/Hz
Noisy signal Kalman filtered signal Wiener filtered signal

1.063 -9.339 -56.43


Author name / Procedia Computer Science 00 (2019) 000–000 7

Manju B.R. et al. / Procedia Computer Science 171 (2020) 273–281 279

Spectrogram of an ECG signal shows the measure of change of spectral densities of different signals with varying
time [18].
Spectrogram visualisation is shown in Fig. 5.
The spectrogram of the ECG signal corrupted by power line interference shows a bright line at 50 Hz which
represents the noise [18]. After denoising by Wiener filter the bright line disappeared from the spectrogram which
shows that the noise is removed efficiently. But the spectrogram of Kalman output contains the bright line which
shows that Kalman filter does not remove the noise effectively

a) b)

c)

Fig. 5. Spectrogram visualisation a) Noisy signal, b) Kalman filtered signal, c) Wiener filtered signal
280 Manju B.R. et al. / Procedia Computer Science 171 (2020) 273–281
8 Author name / Procedia Computer Science 00 (2019) 000–000

Magnitude response of a filter is the value that is characterised by the frequency bands a filter will pass or reject.
Fig.6 shows magnitude response analysis [19]. The two sided Magnitude response plot of noisy signal shows peak at
50Hz and -50Hz.But when filtered by Wiener filter the peaks have disappeared and Kalman filter results shows the
presence of small peaks at 50 Hz and -50 Hz [20].
a)

b)

c)

Fig. 6. Magnitude response of a) Noisy signal, b) Kalman filtered ECG signal, c) Wiener filtered signal
Manju B.R. et al. / Procedia Computer Science 171 (2020) 273–281 281
Author name / Procedia Computer Science 00 (2019) 000–000 9

4. Conclusion

In this paper, we have compared the efficiency of Wiener filter and Kalman filter in denoising ECG signal. The
simulation results have shown that Wiener filter is a better filtering technique than Kalman filter in terms of SNR,
PSD, MSE, PRD. The inefficient performance of the Kalman filter is due to its restricted application to non-linear
systems. Therefore our further study will be on the extended form of Kalman filter which works for both linear and
non-linear systems.

References

[1] Hrishikesh Limaye and V.V. Deshmukh. (2016) " ECG noise sources and various noise removal techniques: A survey.” International Journal
of Application or Innovation in Engineering & Management (IJAIEM): 86-92.
[2] Rajesh D. Wagh, Kiran R. Khandarkar and Shaila P. Kharde. (2014) ”Noise removal from Electrocardiogram (ECG) a comparison
approaches.” International Journal of Advanced Research in Computer Engineering & Technology (IJARCET) : 47-51.
[3] B.R.Manju, A.R.Rajan, V.Sugumaran (2012) “Optimizing the parameters of wavelets for pattern matching using GA” Journal of Advanced
Research in Engineering and Technology’(IJRET): 75-85.
[4] M. Amiri, M. Afzali and B. V. Vahdat. (2012) "Comparison of different electrocardiogram signal power line denoising methods based on
SNR improvement. " 19th Iranian Conference of Biomedical Engineering (ICBME): 159-162.
[5] S. Saxena, R. Jais and M. K. Hota. (2019) "Removal of powerline interference from ECG signal using FIR, IIR, DWT and NLMS adaptive
filter." International Conference on Communication and Signal Processing (ICCSP) : 12-16.
[6] B.R.Manju, A.R.Rajan, V.Sugumaran (2010) “Wavelet Design for Fault Diagnosis of Roller Bearings using Continuous Wavelet
Transform” International Journal for Mechanical Engineering and Technology (IJMET): 38-48.
[7] I. Sharma, R. Mehra and M. Singh. (2015) "Adaptive filter design for ECG noise reduction using LMS algorithm." 4th International
Conference on Reliability, Infocom Technologies and Optimization (ICRITO) (Trends and Future Directions): 1-6.
[8] U. Biswas, A. Das, S. Debnath and I. Oishee. (2014) " ECG signal denoising by using least-mean-square and normalised-least-mean-square
algorithm based adaptive filter.”International Conference on Informatics, Electronics & Vision (ICIEV): 1-6.
[9] Richa Guleria and Ramanpreet Kaur. (2016) “Removing the power line interference from ECG signal using Kalman least mean square filter,”
International Conference on Signal Processing, Communication, Power and Embedded System (SCOPES): 1151-1157.
[10] Reza Sameni , Mohammad Bagher Shamsollahi, Christian Jutten and Massoud Babaie-Zadeh. (2005) ” Filtering noisy ECG signals using the
extended Kalman filter based on a dynamic ECG model.” Computers in Cardiology: 1017-1020.
[11] B. Sharma and R. J. Suji. (2016) "ECG denoising using weiner filter and adaptive least mean square algorithm." IEEE International
Conference on Recent Trends in Electronics, Information and Communication Technology (RTEICT), Bangalore: 53-57.
[12] Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh, Mark RG, Mietus JE, Moody GB, Peng CK and Stanley HE. (2000) ”
PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals.” Circulation: e215--
e220.
[13] M. Niknazar, B. Rivet and C. Jutten.(2013) "Fetal ECG extraction by extended state Kalman filtering based on single-channel recordings,"
IEEE Transactions on Biomedical Engineering: 1345-1352.
[14] M. Chen, Y. Zhong, H. Zhu and Y. Pan (2018) "Kalman Filter Based Electromyographic Signal Suppression of Real-Time ECG Signal,"
2018 Computing in Cardiology Conference (CinC): 1-4.
[15] L. D. Avendano-Valencia, L. E. Avendano, J. M. Ferrero and G. Castellanos-Dominguez.(2007) "Improvement of an extended Kalman filter
power line interference suppressor for ECG signals," Computers in Cardiology: 553-556.
[16] H. Dong.(2012) "Detection of electrocardiography based on wavelet transform and extended Kalman filter," 4th International Conference on
Intelligent Human-Machine Systems and Cybernetics: 138-140.
[17] Yamini Kotriwar, Sneha Kachhara , K. P. Harikrishnan and G. Ambika.(2018) ” Higher order spectral analysis of ECG signals, ” Biomedical
Signal Processing and Control: 1-8.
[18] A.K.M Fazlul Haque, Md. Hanif Ali and Md. Adnan Kiber.(2010) “Improved spectrogram analysis for ECG signal in emergency medical
applications,” International Journal of Advanced Computer Sciences and Applications (THOMSON REUTERS): 39-44.
[19] C.Haritha, Ganesan.M., and Sumesh, E.P, (2016) “A Survey on Modern Trends in ECG Noise Removal Techniques”, Proceedings of IEEE
International Conference on Circuit, Power and Computing Technologies:1-7.
[20] O.N.Swathi, Ganesan. M., and Lavanya. R., (2017) “R Peak Detection and Feature Extraction for the Diagnosis of Heart Diseases”,
International Conference on Advances in Computing, Communications and Informatics (ICACCI): 2388-2391.

You might also like