Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

324 Int. J. Advanced Intelligence Paradigms, Vol. 16, Nos.

3/4, 2020

Simulink implementation of RLS algorithm for


resilient artefacts removal in ECG signal

Vuyyuru Tejaswi*, A. Surendar and


N. Srikanta
Department of E.C.E.,
Vignan Foundation for Science, Technology and Research,
Guntur, AP, India
Email: tejaswireddy.456@gmail.com
Email: surendararavindhan@gmail.com
Email: sri0457@gmail.com
*Corresponding author

Abstract: Noise is the undesired signal which affects the desired signal. This
noise has been a serious problem which is affecting the signals during
transmission of information. In this project, two different noisy signals are
considered they are speech signal and ECG signal. The speech signals are taken
from the NOIZEUS database and ECG signals from Physio Net ECG database.
The major noises affecting the ECG signal are baseline wander, electrode
motion, power line interference, muscle artefact noises. The baseline wander
noise which is caused due to patient movement, breathing and bad electrode
contact to skin, electrode motion noise occurs when electrode moves away
from the skin which leads to impedance changes resulting in variations in ECG,
muscle artefact noise which is caused due to contraction of other muscles
besides the heart. Simulink model is designed for cancelling the noise from the
noisy signals. The adaptive algorithm that is chosen is the RLS algorithm
because it has faster convergence rate when compared to other algorithms like
LMS, NLMS and RLS. The Simulink model is tested for different cases to
show that the model works efficiently and the performance can be observed
from the mean square error obtained.

Keywords: noise; speech; ECG; baseline wander; electrode motion; muscle


artefact; power line interference; RLS filter; MSE.

Reference to this paper should be made as follows: Tejaswi, V., Surendar, A.


and Srikanta, N. (2020) ‘Simulink implementation of RLS algorithm for
resilient artefacts removal in ECG signal’, Int. J. Advanced Intelligence
Paradigms, Vol. 16, Nos. 3/4, pp.324–337.

Biographical notes: Vuyyuru Tejaswi received her MTech degree in


Electronics and Communication Engineering from the Vignan’s University and
is currently working as an Assistant Professor in VFSTR, Vadlamudi. Her
research focuses on signal processing and adaptive filtering for communication
systems.

A. Surendar received his BE degree in Electronics and Communication


Engineering from the K.S.R. College of Engineering, (Anna University,
Chennai), Tiruchengode, India, his ME degree from the Anna University,
Coimbatore, India, and pursuing his PhD degree at the Anna University,
Chennai. Currently, he is with the Vignan’s University, India, as a faculty
member. His research interests include embedded system and bioinformatics.

Copyright © 2020 Inderscience Enterprises Ltd.


Simulink implementation of RLS algorithm 325

He has published research outcomes in several IEEE conferences and


peer-reviewed international journals and has about 25 research publications to
his credit. He is serving as a reviewer of few reputed journals and member of
IEEE Membership and ACM.

N. Srikanta received his BTech degree in Electronics and Communication


Engineering from the JNTU, Hydrabad, India, and MTech degree in Digital
Electronics and Communication Systems from the JNTU, Kakinada, India. He
is currently pursuing his PhD at the Vignan’s University, Andhra Pradesh,
India and working as an Assistant Professor in the Department of ECE,
Vignan’s Foundation for Science, Technology and Research University,
Guntur, India. His research interests are signal processing and microwave
antenna design.

1 Introduction

Noise can be eliminated from any signals by using appropriate filtering techniques. The
most commonly used filtering techniques are fixed and adaptive. In fixed filters, the
signal and noise characteristics must be known beforehand, so that a filter can be
designed which passes the signal frequency and rejects the noise frequency. Whereas in
adaptive filters, it has the capability of adjusting the filter coefficients to reduce the noise
mixed with the signal. Adaptive filters require no prior knowledge of both signal and
noise characteristics. For non-stationary signals, adaptive filters are most commonly
used. Adaptive filters are used in devices like mobile phones, medical equipment and
digital cameras. In clinics, ECG is measured by connecting electrodes on skin surface of
specific parts of the body. ECG is used for recording of electrical events of the heart. In
the clinical environment, an individual heart condition and overall health condition can
be known by observing the ECG report. So, the ECG signals must be very accurate. If
there is some sort of distortions in the ECG signal due to artefacts (Razzaq et al., 2016)
this can impair in the understanding of patient’s cardiac condition. The standard ECG
waveform is shown in Figure 1.
ECG waveform of a normal individual consists of P wave, QRS complex, ST
segment, T wave and U wave. The labels commonly used in medical ECG terminology.
 P wave: when the electrical impulse is conducted from the SA node towards the AV
node and spreads from right to left atrium, the depolarisation (contraction) of the
atria occurs. The depolarisation of atria results the P Wave in the ECG. The PR
interval is measured from the beginning of the P wave to the beginning of the QRS
complex. The normal duration for this is 0.12–0.20 seconds.
 QRS complex: the QRS complex consists of three waves, sequentially known as Q, R
and S. The rapid depolarisation of both the ventricles results this complex. The
muscles of the ventricles have large muscle mass than that of atria, hence its
amplitude is much larger than that of P wave. The duration (QRS interval) which is
measured from the beginning of the QRS complex to its end is 0.05 to 0.10 seconds.
 T wave: ventricular repolarisation results the preceding of ST segment and the
T wave.
326 V. Tejaswi et al.

 U wave: the origin of U wave is not clear and it is rarely seen. It is probably
produced due to the repolarisation of the papillary muscles.

Figure 1 Standard ECG signal (see online version for colours)

To eliminate these artefacts, conventional digital filters like FIR and IIR can be used but
as these filters have fixed number of filter coefficients they cannot completely remove the
noise. To achieve better artefacts removal for non-stationary signals like ECG, adaptive
filters are the best choice (Sharma et al., 2014; Bhoyar and Singh, 2014) There are many
adaptive algorithms like LMS, NLMS and RLS (Wagh et al., 2014; Yadav and Singh,
2010). Here, we used RLS filter because it provides faster convergence rate when
compared to other filters. To show that the RLS filter works in removing artefacts we
have taken ECG signal from MIT-BIH arrhythmia database and real noises from MIT-
BIH noise stress database and mixed these signals and given to the RLS filter, which
should remove the noise and should generate only clean ECG signal.
This paper is organised as in Section 2 a brief concept of adaptive filters and working
of adaptive noise cancellation system is presented. In Section 3, the RLS algorithm is
explained. Section 4 presents the Simulink design and the results. Section 5 presents the
conclusions.

2 Adaptive filters

Adaptive filters are self-learning filters that vary the filter coefficients to adapt to the
signal characteristics changing in accordance with the time.
Simulink implementation of RLS algorithm 327

Figure 2 Block diagram of adaptive filter

Figure 2 is the adaptive filter block diagram in it


 x(n) is the input signal to an adaptive filter at time n
 y(n) is the output signal
 d(n) is another input signal
 e(n) is the error signal, which is the difference between d(n) and y(n).
In Figure 2, the filter coefficients of input signal x(n) are adjusted by the adaptive
algorithm to reduce the error e(n) to recover the original signal.

2.1 Adaptive noise cancellation system


To use the adaptive filters, one must understand the working of this noise cancellation
system (Widrow et al., 1975; Farhang-Boroujeny, 1999). Figure 3 is the adaptive noise
cancellation system.

Figure 3 Adaptive noise cancellation system


328 V. Tejaswi et al.

It consists of two inputs and single output. The primary input is the combination of both
signal and noise that means it is a noisy input. The reference input accepts only noise
signal. The primary and reference noise must be correlated with each other to cancel out
the noise, but these noises must be uncorrelated to primary signal. The reference input is
given to the filter and the filtered output is subtracted from the primary input to get the
error signal, which is an imitate of the clean signal.

3 RLS filter

The RLS filter calculates the filter output, error, weights for the given input and desired
signal using RLS algorithm (Singh and Mehra, 2013). For the RLS filter block, the
desired port accepts noisy signal, the input port accepts noise signal, if the adapt port is
given the value of one it adjusts the filter weights, if it is zero it does not adjust the filter
weights. The output port generates the filtered input signal, the error port gives the signal
which is the difference between desired and output signal.
The RLS algorithm (Kamble and Kuntawar, 2016; Ogireddy and Prabha, 2012) can
be explained by the following steps:
Step 1 For calculating the gain vector
λ  1P(n  1) u(n)
K(n) 
1  λ  1u H (n) P(n  1) u(n)

Step 2 The filtered output can be calculated using


y(n)  w(n  1) u(n)

Step 3 The error can be estimated by


e(n)  d(n)  y(n)

Step 4 Tap weight vector adaptation


w(n)  w(n  1)  K H (n) e(n)

Step 5 The inverse covariance matrix is given by


P(n)  λ1 P(n  1)  λ1K(n) u H (n) P(n  1)

 is the forgetting factor, it has a range of (0, 1].

4 Simulink model and results

This paper presents the design of adaptive noise cancellation system used for cancelling
the background noises by using RLS algorithm (Mugdha et al., 2015). RLS filter block is
available in DSP system toolbox in Simulink. Here in Figure 4, we have showed the
model for babble noise cancellation; similar procedure can be followed for other noise
cancellation.
Simulink implementation of RLS algorithm 329

Figure 4 Simulink model for background noise cancellation using RLS filter
330 V. Tejaswi et al.

The simulation parameters are chosen as:


 filter length = 1
 forgetting factor = 1
 filter weights = 0.5
 initial input variance estimate = 0.1.

Figure 5 Output for babble noise cancellation in speech signal (see online version for colours)

Figure 6 MSE for babble noise (see online version for colours)

4.1 Output
Based on the above idea a modified Simulink model is designed using RLS for artefacts
elimination in the ECG signal. The model is shown in Figure 7.
Simulink implementation of RLS algorithm 331

Figure 7 Simulink model for artefacts removal in ECG signal using RLS filter

Table 1 Shows the MSE for all kinds of noises

Sl. no. Noise type MSE SNR


1 Coloured noise Pink 1.597exp-07 –35.65
White 2.696exp-07 –26.75
Brown 1.5904exp-07 –63.19
Blue 2.0436exp-07 –23.44
Purple 6.7482exp-09 –30.92
Custom 1.5972exp-07 –35.67
2 Random noise Uniform 1.4781exp-08 –29.73
Gaussian 3.9257exp-07 –29.34
3 Airport 0 db 4.6315exp-04 –2.545
5 db 1.2677exp-07 1.971
10 db 1.1503exp-07 5.981
15 db 2.6647exp-07 4.492
4 Babble 0 db 8.4924exp-12 –6.085
5 db 9.0245exp-09 4.01
10 db 3.1119exp-08 7.55
15 db 1.2045exp-07 12.89
5 Exhibition 0 db 1.6223exp-08 –6.336
5 db 2.0442exp-08 5.098
10 db 7.2592exp-09 6.533
15 db 1.0326exp-08 11.2
6 Train 0 db 7.9352exp-08 –3.566
5 db 2.3845exp-09 1.398
10 db 3.5960exp-08 6.612
15 db 3.1274exp-07 10.73
332 V. Tejaswi et al.

In the Simulink model, a noisy ECG signal is given as input to the desired port and noise
alone as input to the input port.
The Physio net database provides accessing to huge number of physiologic signals. In
this Physio net, we are having Physio bank ATM which contains ECG signals from
MIT-BIH arrhythmia database and noise from the MIT-BIH noise stress database they
are available in the form of mat files in that database. These mat files are loaded and the
variables are called form workspace to Simulink. Here, we performed some
pre-processing for the noise using digital filter design block.
 simulation parameters
 forgetting factor = 1
 filter length = 1
 filter weights = 0.5
 input variance = 0.1.
Table 2 Shows the MSE for BW, EM and MA noises

Sl. no. Subjects MSE for ECG BW MSE for ECG EM MSE for ECG MA
1 100 1.258e-05 4.269e-07 3.602e-08
2 101 1.4604e-04 3.0077e-09 1.046e-06
3 103 1.4937e-04 4.6998e-08 5.7974e-05
4 105 1.1608e-04 8.2515e-08 4.7491e-06
5 106 7.6876e-06 9.9172e-08 5.3409e-08
6 111 6.5110e-06 4.2670e-05 1.0169e-07
7 113 9.2257e-04 9.5703e-07 7.7900e-05
8 114 6.1767e-07 1.9900e-07 2.4650e-07
9 115 1.8139e-05 6.1533e-07 1.2133e-04
10 202 1.0797e-04 3.575e-07 3.418e-06
11 205 5.6253e-05 8.5754e-07 3.4754e-05
12 209 9.3315e-05 1.2815e-07 5.3488e-07
13 215 3.5061e-05 4.2000e-08 1.0569e-05
14 223 1.6884e-04 4.0786e-07 3.7527e-06
15 234 9.4648e-06 3.3464e-07 3.9833e-06

We have tested our model for different patients by taking the ECG data available in the
Physio net database. The results obtained when applied to the Simulink model shown in
Figure 7 are:
Simulink implementation of RLS algorithm 333

 For subject 100

Figure 8 In case of baseline wander noise (see online version for colours)

1
Amplitude

0.5

−0.5

0 1 2 3 4 5 6 7 8 9 10
Time (secs)
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Time (secs)
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Offset=0 Time (secs)

Figure 9 In case of electrode motion noise (see online version for colours)
Noisy signal

1
Amplitude

0.5

−0.5

0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Noise signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Error signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Offset=0 Time (secs)

Figure 10 In case of muscle artefact noise (see online version for colours)
Noisy signal

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Noise signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Error signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Offset=0 Time (secs)
334 V. Tejaswi et al.

 For subject 105

Figure 11 In case of baseline wander noise (see online version for colours)
Noisy signal

1
Amplitude

0.5

−0.5

0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Noise signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Error signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Offset=0 Time (secs)

Figure 12 In case of electrode motion (see online version for colours)


Noisy signal

1
Amplitude

0.5

−0.5

0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Noise signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Error signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Offset=0 Time (secs)

Figure 13 In case of muscle artefact noise (see online version for colours)
Noisy signal

1
Amplitude

0.5

−0.5

0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Noise signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Error signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Offset=0 Time (secs)
Simulink implementation of RLS algorithm 335

Figure 14 In case of PLI noise (see online version for colours)

1
Amplitude

0.5

−0.5

0 1 2 3 4 5 6 7 8 9 10
Time (secs)

1
Amplitude

−1

0 1 2 3 4 5 6 7 8 9 10
Time (secs)

0.5
Amplitude

−0.5

−1

0 1 2 3 4 5 6 7 8 9 10
Offset=0 Time (secs)

 For subject 100

Figure 15 In case of baseline wander (see online version for colours)


Noisy signal
2.5

1.5
Amplitude

0.5

−0.5

0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Noise signal
2.5

1.5
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Error signal
2.5

1.5
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Offset=0 Time (secs)

Figure 16 In case of electrode motion noise (see online version for colours)
Noisy signal
2.5

1.5
Amplitude

0.5

−0.5

0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Noise signal
2.5

1.5
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Error signal
2.5

1.5
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Offset=0 Time (secs)
336 V. Tejaswi et al.

Figure 17 In case of muscle artefact noise (see online version for colours)
Noisy signal

1
Amplitude

0.5

−0.5

0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Noise signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Time (secs)
Error signal
1.5

1
Amplitude

0.5

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10
Offset=0 Time (secs)

5 Conclusions

In this paper, we have used RLS filter for cancelling the background noises and for
eliminating artefacts from the ECG signal. From the above results, we can observe that
the RLS filter works efficiently in eliminating the baseline wander noise which is caused
due to patient movement, breathing and bad electrode contact to skin, electrode motion
noise occurs when electrode moves away from the skin which leads to impedance
changes resulting in variations in ECG, muscle artefact noise which is caused due to
contraction of other muscles besides the heart, power line interference noise which is
caused due to improper grounding of patient or the ECG device, electromagnetic
interference by power line. The performance analysis of the signal can be observed from
the MSE obtained which is shown in the tables and in this paper; we have obtained better
MSE values. The future work is to use wavelet based denoising to eliminate artefacts and
compare this with RLS based adaptive filter and apply this algorithms by taking data
from different real-time subjects.

References
Bhoyar, S. and Singh, P. (2014) ‘ECG Noise removal using adaptive filtering’, International
Journal of Engineering Research and Applications, Vol. 4, No. 4, pp.21–24, ISSN: 2248-
9622.
Farhang-Boroujeny, B. (1999) Adaptive Filters – Theory and Applications, pp.2710–2723, John
Wiley and Sons, Chichester, UK.
Kamble, R.S. and Kuntawar, S.V. (2016) ‘Removal of artifacts from ECG signal using RLS based
adaptive filter’, International Journal of Computer Applications (0975–8887), Vol. 149,
No. 3, pp.28–32.
Mugdha, M., Dewasthale, R.D. and Kharadkar, M.B. (2015) ‘Comparative performance analysis
and hardware implementation of adaptive filter algorithms for acoustic noise cancellation’,
International Conference on Information Processing (ICIP), Vishwakarma Institute of
Technology, December 16–19.
Simulink implementation of RLS algorithm 337

Ogireddy, V.S.S.R. and Prabha, I.S. (2012) ‘Noise suppression from ECG signal using LMS and
RLS technique’, International Journal of Advanced and Innovative Research, Vol. 1, No. 2,
pp.8–12.
Razzaq, N., Ali Sheikh, S-A., Salman, M. and Zaidi, T. (2016) An Intelligent Adaptive Filter for
Elimination of Power Line Interference from High Resolution Electrocardiogram, IEEE
Access, Vol. 4, pp.1676–88.
Sharma, A., Toshniwal, S. and Sharma, R. (2014) ‘Noise reduction technique for ECG signals
using adaptive filters’, International Journal of Recent Research and Review, Vol. 7, No. 2,
pp.82–86, ISSN: 2277-8322.
Singh, A. and Mehra, R. (2013) ‘Adaptive filter for ECG noise reduction using RLS algorithm’,
Int. Journal of Engineering Research and Applications, Vol. 3, No. 6, pp.1304–1308,
ISSN: 2248-9622.
Wagh, R.D., Khandarkar, K.R., Shipne, D.D. and Kharde, S.P. (2014) ‘Noise removal from
electrocardiogram (ECG) a comparison approaches’, International Journal of Advanced
Research in Computer Engineering & Technology (IJARCET), Vol. 3, No. 1, pp.47–51.
Widrow, B. et al. (1975) ‘Adaptive noise cancelling: principles and applications’, Proc. IEEE,
Vol. 63, pp.1692–1716.
Yadav, K.L. and Singh, S. (2010) ‘Performance evaluation of different adaptive filters for ECG
signal processing’, International Journal on Computer Science and Engineering, Vol. 40,
No. 5, pp.1880–1883.

You might also like