| 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 |
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 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
|
| 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 |
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.
|
| See Also |
| INIT_ RLS, ASPTRLS. |
| Reference |
| [2] and [4] for analysis of the RLS algorithm and its variants. |