next up previous contents
Next: 20 equalizer_ rls Up: 10 Applications and Examples Previous: 18 echo_ rcpbfdaf   Contents


19 equalizer_ nlms

Purpose
Simulation of an adaptive inverse modeling application using an adaptive filter updated according to the Normalized Least Mean Squares (NLMS) algorithm.

Syntax
equalizer_nlms



Description
Figure 10.37: Block diagram of the inverse modeling application.
The block diagram of the equalization (inverse modeling) problem is shown in Fig. 10.37. The simulation considered here uses a transversal FIR filter for the adjustable filter and the coefficients of the filter are updated using the NLMS algorithm. The input signal $u(n)$ (measured signal at the physical system input) is stored in the file ufile. The physical system output $x(n)$ (the signal measured at the system output in response to applying $u(n)$ at its input) is stored in the file xfile. The desired signal for the equalization problem is a delayed version of the system input signal. In practice, only the system output $x(n)$ is available during normal operation and the system input $u(n)$ should be provided in a training session. First the variables for the adaptive model $w(n)$ are created and initialized using init_nlms(), and the input signals are read from files, then a processing loop is started. In each iteration of the loop asptnlms() is called with a new input sample and a new desired sample to calculate the filter output $y(n)$ and update the filter coefficients. This simulation script uses the standard ASPT iteration progress window (IPWIN). The IPWIN has four buttons which allow you to stop and continue the simulation, show or hide the simulation graph window, break out of the processing loop, and quit the simulation. After processing all the samples, or on pressing the break or stop buttons, the sensor signal $e(n)$ is written to a wave audio file and a graph presenting the echo canceler performance is generated.


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


Code
clear all;
load .\data\h32;                 % for verification

ufile  = '.\wavin\scinwn.wav';   % input signal
xfile  = '.\wavin\scdwn32.wav';  % system output 

h      = h32;
D      = 32;                     % delay in desired path
M      = 64;                     % adaptive model length
mu     = .2/M;                   % Step size
b      = 0.98;                   % smoothing pole

%% Initialize storage 
[w,x,d,y,e,p]    = init_nlms(M);                % Init NLMS algorithm				
[un,x1Fs,x1Bits] = wavread(ufile);              % Get system input
[xn,x2Fs,x2Bits] = wavread(xfile);              % Get system output
inSize           = min(length(un),length(xn));  % Samples to process
E                = init_ipwin(inSize);          % Initialize IPWIN

%% Processing Loop
% The desired signal is the delayed un(n) and the adaptive filter 
% input is xn(n) which is the output of the system to be equalized.

for (m=D+1:inSize)
   x  = [xn(m,:);x(1:M-1,:) ];             % update the delay line
   d  = un(m-D,:);                         % desired sample

   % Update the adaptive filter and calculate the output and error
   [w,y,e,p]= asptnlms(x,w,d,mu,p,b);

   % update the iteration progress window
   [E, stop,brk]	= update_ipwin(E,e,d, 'i', w, h, D);

   % handle the Stop button	
   while (stop ~= 0), stop = getStop; end;
	
   % handle the Break button
	if (brk), plot_invmodel(w,h,E,D); break; end;	
end;

plot_invmodel(w,h,E,D);



Results
Figure 10.38: Performance of the NLMS adaptive algorithm in an inverse modeling application.
Running the above script will produce the graph shown in Fig. 10.38. The two top-left panels in Fig. 10.38 show the time and frequency responses of the optimum solution for the inverse modeling problem at hand. The time and frequency responses for the model obtained by the adaptive filter are shown in the two top-right panels. The bottom panel shows the learning curve for the adaptive filter. Note that the input signal is colored by the physical system which might increase the eigenvalue spread in the adaptive filter input signal $x(n)$. This might result in slow convergence and large final misadjustment at frequencies not well excited when the LMS or one of its derivatives is used to adapt the filter.


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


See Also
INIT_ NLMS, ASPTNLMS, MODEL_ NLMS.

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


next up previous contents
Next: 20 equalizer_ rls Up: 10 Applications and Examples Previous: 18 echo_ rcpbfdaf   Contents