| 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 asptlms() is given by
asptlms() for an FIR adaptive filter of
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 |
% 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 ));gridRunning 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).
|
| 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
|
| 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.
|
| Resources |
The resources required to implement the LMS algorithm for a transversal adaptive FIR filter of
|
| 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. |