next up previous contents
Next: 21 model_ arlmsnewt Up: 10 Applications and Examples Previous: 19 equalizer_ nlms   Contents


20 equalizer_ rls

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

Syntax
equalizer_rls



Description
Figure 10.39: Block diagram of the inverse modeling application.
The block diagram of the equalization (inverse modeling) problem is shown in Fig. 10.39. The simulation considered here uses a transversal FIR filter for the adjustable filter and the coefficients of the filter are updated using the RLS 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_rls(), and the input signals are read from files, then a processing loop is started. In each iteration of the loop asptrls() 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
b      = 0.01;                   % initial diagonal of R
a      = 0.99;                   % forgetting factor

%% Initialize storage 
[w,x,d,y,e,R]    = init_rls(M,b);               % Init RLS 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,R] = asptrls(x,w,d,R,a);  

   % 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.40: Performance of the RLS algorithm in a a channel equalization application.
Running the above script will produce the graph shown in Fig. 10.40. The two top-left panels in Fig. 10.40 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 algorithm.


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


See Also
INIT_ RLS, ASPTRLS.

Reference
[2] and [4] for analysis of the RLS algorithm and its variants.


next up previous contents
Next: 21 model_ arlmsnewt Up: 10 Applications and Examples Previous: 19 equalizer_ nlms   Contents