Professional Documents
Culture Documents
Simulink Implementation of RLS Algorithm
Simulink Implementation of RLS Algorithm
3/4, 2020
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.
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.
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
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)
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.
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
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
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.
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)
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
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)
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.