Adaptive Filtering Using MATLAB
Adaptive Filtering Using MATLAB
Research Article
Analysis of Adaptive Filter Algorithms using MATLAB
P Yadava, KP Gowdb, P.S. Singhelb, A Kharec and SK Paranjpeb*
a
All Saint College of Technology Bhopal, India -462031
b
AISECT University, Bhopal-Chiklod Road, Raisen, Bhopal, India
c
Dept of Electronics and communication, UIT, RGPV, Bhopal, India - 462031
Accepted 10 August 2013, Available online 25 August 2013, Vol.3, No.3 (August 2013)
Abstract
In recent years, adaptive filtering has become one of the effective and popular approaches for the processing and
analysis of the signals with noise especially of the biomedical signals. Adaptive filters permit to detect time varying
potentials and to track the dynamic variations of the signals. Besides, they modify their behavior according to the input
signal. Therefore, they can detect shape variations in the ensemble and thus they can obtain a better signal estimation.
The aim of this paper is to study, analyze various adaptive filter algorithms and apply Mat lab to investigate their
performance behaviors with two step sizes of 0.02 and 0.04. Further to remove motion artifacts from Electrocardiogram
signal as an application of this concepts. At the end of this paper, a performance study has been done between these
algorithms based on various step sizes. It has been found that there will be always tradeoff between step sizes and Mean
square error. The Electrocardiogram signals used in this paper are from the MIT-BIH database. Elimination of noises
from Electrocardiogram signal example is a classical problem.
Keywords: Adaptive filter, Least Mean Square (LMS), Normalized LMS (NLMS), Block LMS (BLMS), Sign LMS (SLMS),
Signed Regressor LMS (SRLMS), Motion artifact.
1130
P Yadav et al International Journal of Current Engineering and Technology, Vol.3, No.3 (August 2013)
made by filtering X (n). The different types of adaptive coefficients are held constant over each block of L
filter algorithms can be explained as follows. samples, and the filter output y(n) and the error e(n) for
each value of n within the block are calculated using the
(a) LMS Algorithm filter coefficients for that block. Then at the end of each
block, the coefficients are updated using an average for the
The LMS algorithm is a method to estimate gradient L gradients estimates over the block.
vector with instantaneous value. It changes the filter tap
weights so that e (n) is minimized in the mean- square (e) Normalized LMS Algorithm (NLMS)
sense. The conventional LMS algorithm is a stochastic
implementation of the steepest descent algorithm. It In NLMS, the step size takes the form of,
simply replaces the cost function
ξ (n) = E [e2 (n)] (7)
by its instantaneous coarse estimate. The error estimation
e(n) is Where β is a normalized step size with 0< β<2. When x(n)
is large, the LMS experiences a problem with gradient
e (n) = d(n) – w(n) X(n) (2) noise amplification. With the normalization of the LMS
Coefficient updating equation is step size by ||x(n)||2 in the NLMS, noise amplification
problem is diminished.
w (n+1) = w(n) + μ x(n) e(n), (3)
2. Methodology
Where μ is an appropriate step size to be chosen as 0 < μ <
0.2, for the convergence of the algorithm. The larger step Electrocardiogram is a method of monitoring and
sizes make the coefficients to fluctuate wildly and recording the electric currents generated during the
eventually become unstable. The most important members alternating contractions of the atria and ventricles of the
of simplified LMS algorithms are: heart. The device used to monitor and record these signals
is an electrocardiogram more commonly referred to as an
(b) SRLMS Algorithm Electrocardiogram. When using an Electrocardiogram,
electrodes are applied to the skin in places where the
The signed regressor algorithm is obtained from the heart’s signals can be measured easily. Cables connect the
conventional LMS recursion by replacing the tap- input electrodes to the Electrocardiogram where the electrical
vector x (n) with the vector sgn{x(n)} .Consider a signed signal is turned into a waveform on a computer or a paper
regressor LMS based adaptive filter that processes an plot. The results produced from this machine allow
input signal x(n) and generates the output y(n) as per the physicians to observe the performance and condition of
following: the heart as well as diagnose any problems they may find
in the signal. When the doctors are examining the patient
y (n) = wt (n)x(n) (4) on-line and want to review the Electrocardiogram signal
waveform in real-time, there is a good chance that the
where, w(n) = [ w0(n), w1(n), ... , wL-1(n) ]t is a L-th signal has been contaminated by baseline wander (BW),
order adaptive filter. The adaptive filter coefficients are power line interference (PLI), muscle artifacts (MA) and
updated by the Signed-regressor LMS algorithm as, electrode motion artifacts (EM) etc., mainly caused by
patient breathing, movement, power line noise, bad
w (n+1) = w(n) + μ sgn{x(n)}e(n) (5) electrodes and improper electrode site preparation. All
these noises mask the tiny features of the signal and leads
Because of the replacement of x(n) by its sign, to false diagnosis. To allow doctors to view the best signal
implementation of this recursion may be cheaper than the that can be obtained, we need to develop an adaptive filter
conventional LMS recursion, especially in high speed to remove the artifacts in order to better obtain and
applications such as biotelemetry these types of recursions interpret the respiratory signal data.
may be necessary. In this proposed methodology simulation was carried
out using powerful MATLAB tool to investigate the
(c) SLMS Algorithm performance behaviors of various adaptive filter
algorithms in non-stationary environment with two step
This algorithm is obtained from conventional LMS sizes of 0.02 and 0.004. The principle means of
recursion by replacing e(n) by its sign. This leads to the comparison is the error cancellation capability of the
following recursion: algorithms which depends on the parameters such as step
w(n+1) = w(n) + μ x(n) sgn{e(n)} (6) size, filter length and number of iterations. A synthetically
generated motion artifact is added with Electrocardiogram
(d) Block LMS Algorithm (BLMS) signals. It is then removed using adaptive filter algorithms
such as LMS, Sign LMS, Signed Regressor, BLMS and
To reduce the computational requirements of LMS NLMS. All Simulations presented are averages over 1000
algorithm, block LMS is introduced. Here the filter independent runs.
1131
P Yadav et al International Journal of Current Engineering and Technology, Vol.3, No.3 (August 2013)
1132
P Yadav et al International Journal of Current Engineering and Technology, Vol.3, No.3 (August 2013)
Fig.5. LMS adoptive filter squared error plot of Fig.9. NLMS adoptive filter squared error plot of
trajectories for μ=0.004 trajectories for μ=0.004
1133
P Yadav et al International Journal of Current Engineering and Technology, Vol.3, No.3 (August 2013)
4. Comparative assessment of results LMS. The merits of LMS algorithm is less consumption of
memory and amount of calculation. It has been found that
Table 1 provides the comparison of mean squared error there will be always tradeoff between step sizes and Mean
(MSE) and Convergence rate (C in terms of number of square error. It is also observed that the performance
iterations that the filter coefficients converge) of different depends on the number of samples taken for consideration.
algorithms. It is observed from Figure 2 and Figure 3, the
convergence speed for μ =0.02 is faster than μ=0.004. But Table 2: Comparison of MSE in removing motion
MSE performance is comparatively better for μ=0.004 artifacts
than μ=0.02. Convergence rate of LMS algorithm is better
when μ=0.02 and low MSE value when μ=0.004. It is also Algorithm Motion Artifacts
inferred that the MSE performance of Sign Regressor
LMS (SRLMS) at the step size of 0.02 is better when
compared to other algorithms. But there is always tradeoff μ=0.02 μ=0.004
between convergence rate and mean squared error. Hence MSE MSE
choosing an algorithm depends on the parameter on which LMS 1 .6e-007 2.66e-005
system has more concern. BLMS 3.2e-004 0.016
Table 1: Comparison of MSE and Convergence Rate SR LMS 5.4e-007 2.153e-007
SIGN LMS 2.0e-007 1.213e-005
Algorithm µ=0.02 µ=0.004 SIGN-SIGN LMS 3.5e-006 5.559e-007
NLMS β = 0.05 β = 0.01
MSE C MSE C 2. 1e-007 1 .057e-008
LMS 2.3873e 10 5.4907e 25
-004 0 -005 0 Conclusion
SRLMS 8.5993e 10 5.3036e 55 This study has revealed useful properties of various
-006 0 -004 0 adaptive filter algorithms. The objective is to optimize
SLMS 1.3406e 10 4.9436e 55 different adaptive filter algorithms so that we can reduce
-004 0 -005 0 the MSE so as to improve the quality of eliminating
interference. It is inferred that the MSE performance is
BLMS 4.9514e 20 8.7072e 50
better for NLMS when compared to LMS. The merits of
-004 0 -004 0 LMS algorithm is less consumption of memory and
NLMS β=0.05, 10 β=0.01, 70 amount of calculation. It has been found that there will be
6.8306e 0 0.0012 0 always tradeoff between step sizes and Mean square error.
-004 It is also observed that the performance depends on the
number of samples taken for consideration. Choosing an
algorithm depends on the parameter on which the system
Table 2 shows the comparison of resulting mean square has much concern. The future work includes the
error while eliminating Motion Artifacts from respiratory optimization of algorithms for all kinds of noises and to
signals using various adaptive filter algorithms with use the optimized one in the implementation of DSP
different step sizes. The observed MSE for LMS as shown Microcontroller that estimates the respiratory signal.
in Figure 5 (a) is very low for μ =0.02 compared with μ
=0.004. The performance of BLMS depends on block References
length L and NLMS depends on the normalized step size
β. Observing all cases, we can infer that choosing μ =0.02 B. Widrow, J. Glover, J. M. McCool, J. Kaunitz, C. S. Williams,
for the removal of power line interference is better when R. H.Hearn, J. R. Zeidler, E.Dong, and R. Goodlin (Dec
compared to μ =0.004. The step size μ =0.004 can be used 1975),Adaptive noise cancelling: Principles and applications ,
unless the convergence speed is a matter of great concern. Proc. IEEE, vol.63, pp.1692-1716.
It is found that the value of MSE also depends on the A. K. Barros and N. Ohnishi (Sept 1997),MSE behavior of
number of samples taken for analysis. biomedical event-related filters, IEEE Trans. Biomed. Eng.,
From the simulation results, the proposed adaptive vol. 44, pp. 848-855.
filter can support the task of eliminating motion artifacts O. Sayadi and M. B. Shamsollahi (Jan 2008),Model-based
fiducial points extraction for baseline wander
with fast numerical convergence. The mean square value electrocardiograms, IEEE Trans. Biomed. Eng., vol. 55, pp.
obtained in this work is found to be very low by varying 347-35 1.
the step sizes and increasing the number of iterations. An Y. Der Lin and Y. Hen Hu (Jan 2008),Power-line interference
FIR filter order of 32 and adaptive step size parameter (μ) detection and suppression in ECG signal processing, IEEE
of 0.02 and 0.004 are used for LMS and modified step Trans. Biomed. Eng., vol. 55, pp. 354-357.
sizes (β) of 0.01 and 0.05 for NLMS. It is inferred that the N. V. Thakor and Y.-S. Zhu (1991),Applications of adaptive
MSE performance is better for NLMS when compared to filtering to ECG analysis: noise cancellation and arrhythmia
1134
P Yadav et al International Journal of Current Engineering and Technology, Vol.3, No.3 (August 2013)
1135