You are on page 1of 6

MATLAB Simulation Comparison for Different Adaptive Noise Cancelation

Algorithms

Mostafa Guda, Safa Gasser and Mohamed S. El Mahallawy


Department of Electronics & Communications Engineering
Arab Academy for Science, Technology and Maritime Transport, Egypt
mostafa.guda@hotmail.com, safagasser@aast.edu, mahallawy@aast.edu

ABSTRACT biological and environmental resources. The


first type includes muscle contraction,
Electrocardiographic (ECG) signal can be electromyographic (EMG) interference,
contaminated by diverse forms of noise: baseline baseline drift, ECG amplitude modulation due
wander, 60 Hz power line interference, muscle to respiration, and motion artefacts caused by
noise, and motion artifact. 60Hz power line changes in the electrode-skin impedance with
interference can be cancelled using two different electrode motion. The second type includes
approaches; an adaptive filter or notch filters. The
power line interference, electrode contact noise,
adaptive filter essentially minimizes the mean-
squared error between a primary input, which is the instrumentation noise generated by electronic
noisy ECG, and a reference input, which is either devices used in signal processing,
noise that is correlated in some way with the noise electrosurgical noise, and radio-frequency
in the primary input or a signal that is correlated [2],[3]. One common type of noise that occurs
only with ECG in the primary input. In this paper during ECG collection is power line
we present a MATLAB simulation comparison interference of 60Hz.
between different adaptive filter algorithms; Least ECG noise cancellation has long puzzled the
Mean Square (LMS), Normalised LMS (NLMS), research community. There has been a
Variable Step size LMS (VSLMS), Recursive Least tremendous amount of research on how to
Square (RLS) and Blind LMS. The comparison is cancel noise in an ECG signal.
carried out in terms of both, MSE and the algorithm
In [4] the authors used an Adaptive Noise
convergence rate.
Canceller (ANC) using the Least Mean Square
(LMS) algorithm. The LMS algorithm was
KEYWORDS
devised by Widrow and Hoff in 1959. The
ECG;ANC;LMS;NLMS;VSLMS;RLS;MSE;Blind advantage of using the algorithm in [4] is its
LMS low computational complexity, while it lacks
the high convergence speed due to its fixed step
1 Introduction size.
The authors in [5], [6] introduced another ANC
The Electrocardiographic (ECG) signal is the based on the Normalized LMS (NLMS)
physical interpretation of the electrical behavior algorithm. This algorithm has a higher
created by the heart muscles. This electrical convergence rate than the algorithm used in [4].
activity of the heart is captured over time by an The NLMS algorithm is also based on a fixed
external electrode attached to the skin and step size as the LMS.
recorded by a device external to the body. The In [7] the Variable Step size LMS was
ECG signal frequency ranges from 0.5 to 100 simulated. This algorithm has better estimation
Hz [1]. ability but it also has high computational
The ECG signal is normally corrupted with complexity compared to the algorithms used in
two major types of noise generated by [4], [5] and [6].

ISBN:978-0-9891305-6-1 ©2014 SDIWC 68


A new approach was experimented in [8]. The (3)
authors used the Recursive Least Square
algorithm (RLS) in the ANC to eliminate the
ECG noise. The main disadvantage of this 2.2 NLMS Algorithm:
algorithm is its very high computational
complexity, while its advantage is its fast In (3), we notice that the step size depends on
convergence rate. the eigen values which make the mathematical
In [9] the authors used an adaptive filter process more complex. To make the
without a reference signal to cancel the ECG calculations easier in the NLMS algorithm the
noise. Other notation for this technique is Blind step size depends on the autocorrelation
adaptive filter. between of input signal, where
In this paper we give a simulation comparison
of the previously mentioned algorithms to (4)
cancel the power line interference occurring at
60 Hz of an ECG signal. Thus, this paper is
divided as follows: in Section II we give an The weights are consequently updated such that
overview about the theory of adaptive [4-6]
algorithms used in the ANC. In Section III we
show the simulation results obtained for LMS, ( ) ( ) ( ) ( ) (5)
NLMS, VSLMS, RLS and Blind LMS
algorithms when used in cancelling noise
occurring in an ECG signal along with a 2.3 VSLMS Algorithm
comparison of the MSE obtained in each
algorithm. In Section IV we sum up our work As opposed to a fixed step size, the VSLMS
and conclude our paper. algorithm improves the step size calculation by
making it variable in each iteration, where
( ) ( ) ( ) ( ) (6)
2 Adaptive Algorithms
( ) ( ) ( ) (7)
In this section we briefly explain each
algorithm and how each one differs in terms of Where g(n) is a gradient function. Finally, the
its update equation computation. weights are updated such that
( ) ( ) ( ) (8)
2.1 LMS Algorithm 2.4 RLS Algorithm
All the previous algorithms process the signals
The LMS algorithm uses the following equation one sample at a time. The RLS algorithm
to update the filter coefficients [1-3], [10-12]. processes the signal in overlapping blocks of
. samples. This increases the computational
w(n+1)=w(n)+2µe(n)x(n) (1) complexity and makes it harder to be
implemented. The filter weights are updated as
Where x(n) is the input vector, w(n) is the follows [10]
vector containing the filter coefficients and e(n)
is the error function given by ( ) ( ) ( ) (9)
( ) ( ) (10)
( ) ( )
e(n)=d(n)-w(n)x(n) (2)
( ) ( ) ( ) ( ) (11)
( )
µ, the step size, depends on the eigen values of ( ) ( ) (12)
the input signal where ( )[ ( ) ( )]

ISBN:978-0-9891305-6-1 ©2014 SDIWC 69


Where k(n) is a gain vector. We notice the level amplitude when compared to that used in the
of complexity of the mathematics involved. other algorithms simulation. The purpose of
Despite having good results, the complexity of this step is to show the convergence of the
the algorithm makes it less usable and difficult algorithm and the noise cancelling step.
to implement.

2.5 Blind LMS Algorithm

The Blind LMS algorithm is very useful for


applications where it is hard to obtain
information about the noise affecting the input
signal. The input signal is delayed to make it
possible to get an early version of the noise for
processing [1]. Then equations (1), (2) and (3)
are used to cancel the noise.

3 Simulation Results

For the analysis of the ANC, the ECG real time


Figure 2. MSE of ANC Using LMS Algorithm
data are obtained from [13]. The noise is known
to be sinusoidal with unknown amplitude and
Since all algorithms are iterative, the noise still
phase. A reference signal is considered, which
appears in the first 100 samples. It gradually
has a different amplitude as well as phase than
decreases until it is approximately cancelled
that of the noise. A filter of order 10 was
from the signal as seen in “Fig.1”. Another way
simulated using MATLAB, as the results
to analyze the ability of the algorithm to cancel
obtained from the simulation are represented
the noise is the MSE. As seen in “Fig.2”, the
below.
error in estimation at starts at its highest value
3.1 LMS Simulation Results
and then converges gradually to approximately
the zero level. The convergence rate is affected
by the noise level, the filter order and the
choice of the step size.

3.2 NLMS Simulation Results

In the NLMS algorithm, the step size is a


function of the input signal rather than being a
function in its eigen values. The main
advantage is to reduce the computations time
and complexity of the algorithm.
We can see that “Fig.1” and “Fig.3” are almost
the same. The noise starts to vanish after the
first hundred samples. The NLMS MSE curve
Figure 1. ANC Simulation Using LMS Algorithm starts at a value lower than that of the LMS
algorithm and also converges faster as seen in
Worth mentioning that the reference signal used “Fig.2” and “Fig.4”.
in the LMS algorithm simulation is different in

ISBN:978-0-9891305-6-1 ©2014 SDIWC 70


Figure 3. ANC Simulation Using NLMS Algorithm

Figure 6. MSE of ANC Using VSLMS Algorithm

The VSLMS algorithm updates the step size in


a way that makes it variable between the
iterations. This helps the algorithm converge
faster and get a better estimation of the noise
signal.
Due to the step size being variable in this
algorithm, the noise is cancelled quicker than
the previous algorithms as seen in “Fig.5”. It is
also clear in “Fig.6” that both the convergence
rate and the MSE are better than those of
“Fig.2” and “Fig.4”.
Figure 4. MSE of ANC Using NLMS Algorithm
3.4 RLS Simulation Results
3.3 VSLMS Simulation Results

Figure 7. ANC Simulation Using RLS Algorithm


Figure 5. ANC Simulation Using VSLMS Algorithm

ISBN:978-0-9891305-6-1 ©2014 SDIWC 71


Figure 8. MSE of ANC Using RLS Algorithm Figure 10. MSE of ANC Using Blind LMS Algorithm

In the RLS algorithm, we used a block of 10 3.6 MSE Comparison


samples for processing. In each iteration there One of the methods to compare the
are 9 common samples being processed and one performance of two or more algorithms is the
new sample. This helps in achieving a near MSE. The MSE curve shows how the error
correct estimation through processing the function behaves with the increase in the
sample more than once as seen in “Fig.7”. The number of iterations. As seen in “Fig.11”, the
MSE becomes better and the algorithm LMS algorithm has the highest starting value
converges faster as noticed in “Fig.8”. for the MSE. It also has the slowest
convergence rate. The NLMS algorithm has
3.5 Blind LMS Simulation Results both, a better convergence rate and better MSE
values. The VSLMS algorithm shows good
In the Blind LMS algorithm, we made the improvement and better performance than the
reference signal a version of the noise signal. previously mentioned algorithms. The RLS
This made the convergence rate faster than that algorithm is the quickest to converge and has
of the LMS as seen in “Fig.9”. Consequently, the best MSE values. The Blind LMS algorithm
the error in estimating the noise signal is much shows better convergence rate than that of the
better as seen in “Fig.10”. LMS algorithm.

Figure 9. ANC Simulation Using Blind LMS Algorithm Figure 11. MSE Comparison of ANC Algorithms

ISBN:978-0-9891305-6-1 ©2014 SDIWC 72


4 Conclusion 5 REFERENCES

In this paper we introduced the simulation [1] D. Bhoyar, and P. Singh, “ECG Noise Removal
using Adaptive Filtering”, International Journal of
results and comparison of different algorithms Engineering Research and Applications (IJERA)
used in 60 Hz noise cancellation of an ECG ISSN: 2248-9622, International Conference on
Industrial Automation and Computing (ICIAC- 12-
signal. The simulation was done using 13th April 2014)
MATLAB program. [2] S. A. Rehman, and R.R. Kumar, “Performance
Comparison of Adaptive Filter Algorithms for ECG
The first simulated algorithm was the LMS Signal Enhancement”, International Journal of
algorithm. This algorithm processes the given Advanced Research in Computer and
Communication Engineering Vol. 1, Issue 2, April
input signal one sample at a time through using 2012
a constant step size. It has the slowest [3] S. Anjana, and X. A. Mary, “Noise Cancellation
Using Adaptive Filters in FPGA”, Research Journal
convergence rate and the highest MSE. of Recent Sciences, Vol. 3(ISC-2013), 4-8 (2014)
The second simulated algorithm was the NLMS [4] B. Widrow, J. R. Glover JR., J. M. Mccool, J.
algorithm. The step size in this algorithm was a Kaunitz, C. S. Williams, R. H. Hean, J. R. Zeidler,
E. Dong JR., and R. C. Goodlin, “ Adaptive Noise
function of the input signal. This modification Cancelling: Principles and Applications”. Proc.
resulted in a faster convergence rate and a IEEE, Vol. 63, NO. 12, December 1975
[5] R. K. Thenua, and S. K. Agrawal, “Hardware
better MSE when compared to the LMS Implementation of Adaptive Algorithms for Noise
algorithm. Cancellation”, International Journal of Information
and Electronics Engineering, Vol. 2, No. 2, March
The third simulated algorithm was the VSLMS 2012
algorithm. This algorithm introduced a variable [6] G. Sundeep, U. V. Ratna Kumari, “Reduction of
Power Line Interference by Using Adaptive Filtering
step size to the adaptive filter. This step size Techniques in Electrocardiogram”, International
would be a function of the step size in the Journal of Innovative Technology and Exploring
Engineering (IJITEE) ISSN: 2278-3075, Volume-1,
previous iteration. The step size value is also Issue-5, October 2012
limited by a certain range in order to ensure the [7] M. Hutson, Acoustic Echo Cancellation Using
algorithm converges within the range of the Digital Signal Processing, The School of
Information Technology and Electrical Engineering,
given data. The University of Queensland, November 2003
The fourth simulated algorithm was the RLS [8] A. Singh, R. Mehra, “ Adaptive Filter for ECG
Noise Reduction Using RLS Algorithm”, Int.
algorithm. This algorithm is unique in its way [9] Journal of Engineering Research and Applications
of processing the given input data. The data is ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013,
pp.1304-1308
processed in blocks instead of one sample at a
[10] C. Chang, H. Ko, and K. Chang, “Cancellation of
time as was the case in the LMS algorithm. The High-Frequency Noise in ECG Signals Using
larger the overlap between the processed Adaptive Filter without External Reference”, 3rd
International Conference on Biomedical Engineering
blocks, the better the results will be. This and Informatics (BMEI 2010)
algorithm also has a constant step size. The [11] D.C. Dhubkarya, A. Katara, and R.K. Thenua,
“Simulation of Adaptive Noise Canceller for an
RLS algorithm has a better convergence rate ECG signal Analysis”, ACEEE Int. J. on Signal &
and also a better MSE compared to the LMS Image Processing, Vol. 03, No. 01, Jan 2012
algorithm. [12] R. K. Thenua, and S. K. Agrawal, “Hardware
Implementation of Adaptive Algorithms for Noise
The final simulated algorithm was the Blind Cancellation”, International Journal of Information
LMS. The difference in this algorithm is in the and Electronics Engineering, Vol. 2, No. 2, March
2012
reference signal introduced to the adaptive [13] G. Singh, K. Savita, S. Yadav, V. Purwar, “Design
filter. Instead of trying to get an estimate of the of Adaptive Noise Canceller Using LMS
Algorithm”, International Journal of Advanced
noise signal, we define the reference signal to Technology & Engineering Research (IJATER),
be the noise signal. The input data is Volume 3, Issue 3, May 2013
[14] http://physionet.org/cgi-bin/atm/ATM/accessed on
consequently introduced to the filter with a May 30,2014
delay. This new adjustment results in a better
estimation and faster noise cancellation
compared to the ordinary LMS algorithm.

ISBN:978-0-9891305-6-1 ©2014 SDIWC 73

You might also like