next up previous contents
Next: 10 asptmvsslms Up: 4 Transversal and Linear Previous: 8 asptlclms   Contents


9 asptlms

Purpose
Sample per sample filtering and coefficient update using the Least Mean Squares (LMS) or one of its variants. The variants currently implemented are the sign, sign-sign, and signed regressor algorithms.

Syntax
[w,y,e]= asptlms(x,w,d,mu)
[w,y,e]= asptlms(x,w,d,mu,alg)

Description
asptlms() implements the LMS adaptive algorithm used to update transversal adaptive filters. Referring to the general adaptive filter shown in Fig. 2.6, asptlms() takes an input samples delay line $x(n)$, a desired sample $d(n)$, the vector of the adaptive filter coefficients from previous iteration $w(n-1)$, the step size $mu$, and returns the filter output $y(n)$, the error sample $e(n)$ and the updated vector of filter coefficients $w(n)$. The update equation of asptlms() is given by
\begin{displaymath}
\vw (n) = \vw (n) + \mu e(n) \vx (n).
\end{displaymath} (33)

Coefficients update is performed according to the 'alg' input argument which can take any of the following values.
  • 'lms' : the default value, uses the LMS algorithm
  • 'slms' : uses the sign LMS algorithm, the sign of the error $e(n)$ is used in the update equation instead of the error.
  • 'srlms' : uses the signed regressor LMS algorithm, the sign of the input signal $x(n)$ is used in the update equation instead of the input signal.
  • 'sslms' : uses the sign-sign-LMS algorithm, the sign of the error $e(n)$ and the sign of the input signal $x(n)$ are used in the update equation instead of the error and the input signals.
The input and output parameters of asptlms() for an FIR adaptive filter of $L$ coefficients are summarized below.
Input Parameters [size] :: 
   x   : vector of input samples x(n) [L x 1]
   w   : vector of filter coefficients w(n-1) [L x 1]
   d   : desired output d(n) [1 x 1]
   mu  : adaptation constant
   alg : specifies the variety of the lms to use in the 
         update equation. Must be one of the following: 
         'lms' [default] 
         'slms'  - sign LMS, uses sign(e)
         'srlms' - signed regressor LMS, uses sign(x)
         'sslms' - sign-sign LMS, uses sign(e) and sign(x)
Output parameters ::
   w   : updated filter coefficients w(n)
   y   : filter output y(n)
   e   : error signal; e(n) = d(n) - y(n)



Example
Figure 4.10: The adaptive filter coefficients after convergence and the learning curve for the complex FIR system identification problem using the LMS algorithm.
% LMS used in a simple system identification application.
% By the end of this script the adaptive filter w should
% have the same coefficients as the unknown filter h.
%
iter = 5000;                  % Number of samples to process
% Complex unknown impulse response
h    = [.9 + i*.4; 0.7+ i*.2; .5; .3+i*.1; .1];     
xn   = 2*(rand(iter,1)-0.5);  % Input signal, zero mean random.
% although xn is real, dn will be complex since h is complex
dn   = osfilter(h,xn);        % Unknown filter output 
en   = zeros(iter,1);         % vector to collect the error
% Initialize the LMS algorithm with a filter of 10 coef.
[w,x,d,y,e]=init_lms(10); 

%% Processing Loop
for (m=1:iter)   
   x = [xn(m); x(1:end-1)];  % update the input delay line
   d = dn(m,:) + 1e-3*rand;  % additive noise of var = 1e-6   
   % call LMS to calculate the output, estimation error
   % and update the coefficients. 
   [w,y,e]= asptlms(x,w,d,0.05);
   % save the last error sample to plot later
   en(m) = e;  
end;

% display the results
% note that w converges to conj(h) for complex data
subplot(2,2,1);stem([real(w) imag(conj(w))]); grid;
subplot(2,2,2);eb = filter(.1,[1 -.9], en .* conj(en));
plot(10*log10(eb  ));grid
Running the above script will produce the graph shown in Fig. 4.10. The left side graph of the figure shows the adaptive filter coefficients after convergence which are almost identical to the unknown filter h. The right side graph shows the square error in dB versus time during the adaptation process, which is usually called the learning curve. The lower limit of the error signal power in the learning curve is defined here by the additive white noise added at the filter output (-60 dB).


\epsfig{file=/home/john/winD/docs/aspt/aspt/figs/lmsex1.eps,width=0.9\textwidth}

Algorithm
The LMS algorithm and its normalized version NLMS are the most widely used adaptive algorithms in the industry due to their low complexity, good performance, and extensive existing analysis. The current implementation of asptlms() performs the following operations
  • Filter the input signal $x(n)$ through the adaptive filter $w(n-1)$ to produce the filter output $y(n)$.
  • Calculates the error sample $e(n) = d(n) - y(n)$.
  • Updates the adaptive filter coefficients using the error $e(n)$ and the delay line of input samples $x(n)$ resulting in $w(n)$.
Remarks
The LMS algorithm is a stochastic implementation of the steepest-descent algorithm where the mean value of the filter coefficients converge towards their optimal solution. Therefore, the filter coefficients will fluctuate about their optimum values given by the Wiener solution. The amplitude of the fluctuations is controlled by the step size. The smaller the step size, the smaller the fluctuations (less final misadjustment) but also the slower the adaptive coefficients converge to their optimal values. Note also the following.
  • The LMS algorithm shows stable convergence behavior only when the step size $mu$ (convergence constant) takes a value between zero and an upper limit defined by the statistics of the filter's input signal. The fastest convergence will be achieved for a white noise input sequence with zero mean and unit variance. Such white input signal has all its eigen values equal to unity and therefore has a diagonal autocorrelation matrix with diagonal values equal to unity.
  • The more colored the spectrum of the input signal, the slower the convergence will be. This is due to the large eigen value spread for such colored signals. This makes the convergence composed of several modes, each associated with one of the eigen values.
  • asptlms() supports both real and complex data and filters. The adaptive filter for the complex LMS algorithm converges to the complex conjugate of the optimum solution.
  • asptlms() does not update the input delay line for $x(n)$, this has been chosen to provide more flexibility, so that the same function can be used with transversal as well as linear combiner structures. Delay line update, by inserting the newest sample at the beginning of the buffer and shifting the rest of the samples to the right, has to be done before calling asptlms() as in the example above.



Resources
The resources required to implement the LMS algorithm for a transversal adaptive FIR filter of $L$ coefficients in real time is given in the table below. The computations given are those required to process one sample.


MEMORY $2L + 4$
MULTIPLY $2L + 1$
ADD $2L$
DIVIDE 0

See Also
INIT_ LMS, BEAMRF_ LMS, ASPTNLMS, ASPTVSSLMS, ASPTLCLMS.

Reference
[11] and [4] for extensive analysis of the LMS and the steepest-descent search method.

next up previous contents
Next: 10 asptmvsslms Up: 4 Transversal and Linear Previous: 8 asptlclms   Contents