| Purpose |
| Simulation of an adaptive forward modeling application using a recursive adaptive filter updated according to the Output Error algorithm. |
| Syntax |
model_outerr
|
| Description |
The block diagram of the system identification (forward modeling) problem using the
Output Error adaptive algorithm is shown in Fig. 10.49 (see Section
6.3 for more details on the Output Error algorithm). The simulation considered
here uses a recursive filter for the adjustable filter and the coefficients of the
filter are updated using the Output Error algorithm. The input signal init_outerr(), and the input
signals are read from files, then a processing loop is started. In each iteration of
the loop asptouterr() is called with a new input sample and a new desired sample
to calculate the filter output (estimated desired signal) 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
|
| Code |
clear all; infile = '.\wavin\scinwn.wav'; % input signal dfile = '.\wavin\scdar22.wav'; % desired signal N = 2; % number of zeros M = 2; % number of poles H = 50; % response length p1 = .2 + j* .85; % unknown filter poles p2 = .2 - j* .85; % for verification ip = [1; zeros(H-1,1)]; % impulse vector h = filter([0.6 -.01],[1 -(p1+p2) (p1*p2)],ip); % Initial parameters u0 = zeros(N+M,1); % composite input vector w0 = u0; % initial filter vector c0 = u0; % initial delay line d0 = randn(1,1); % initial desired sample mu = [.01;0.01;.001;0.001] ; % Step size vector % Create and initialize OUTERR IIR filter [u,w,c,y,d,e,mu,Px,Py] = init_outerr(N,M,u0,w0,c0,d0,mu); [xn,inFs,inBits] = wavread(infile); % read input [dn,inFs,dBits] = wavread(dfile); % read desired inSize = max(length(dn),length(xn)); % samples to process E = init_ipwin(inSize); % Initialize IPWIN %% Processing Loop for (m=1:inSize) x = 2^(inBits-1) * xn(m); % input sample d = 2^(inBits-1) * dn(m); % desired sample % update the filter [u,w,c,y,e,Px,Py] = asptouterr(N,M,u,w,c,x,d,mu,Px,Py); % impulse response for verification wp = filter(w(1:N),[1 ; -w(N+1:N+M)],ip); % update the iteration progress window [E, stop,brk] = update_ipwin(E,e,d, 'm', wp, h); % handle the Stop button while (stop ~= 0), stop = getStop; end; % handle the Break button if (brk), plot_model(wp,h,E); break; end; end; plot_model(wp,h,E); |
| Results |
Running the above script will produce the graph shown in Fig. 10.50. The two top-left panels in Fig. 10.50 show the time and frequency responses of the unknown system for which this application is intended to provide an IIR model. The time and frequency responses for the model obtained by the adaptive filter are shown in the two top-right panels. The bottom-left panel shows the learning curve and the bottom-right panel shows the estimation error in the impulse response.
|
| See Also |
| INIT_ OUTERR, ASPTOUTERR. |
| Reference |
| [2] and [10] for introduction to recursive adaptive filters. |