next up previous contents
Next: 28 model_ tdlms Up: 10 Applications and Examples Previous: 26 model_ rlslattice   Contents


27 model_ sharf

Purpose
Simulation of an adaptive forward modeling application using an recursive adaptive filter updated according to the Simple Hyperstable Adaptive Recursive Filter (SHARF) algorithm.

Syntax
model_sharf



Description
Figure 10.53: Block diagram of the forward modeling application using the SHARF algorithm.
The block diagram of the system identification (forward modeling) problem using the SHARF adaptive algorithm is shown in Fig. 10.53 (see Section 6.4 for more information on the SHARF algorithm). The simulation considered here uses a recursive filter for the adjustable filter and the coefficients of the filter are updated using the SHARF algorithm. The input signal $x(n)$ (measured signal at the input of the system to be modeled) is stored in the file infile. The desired signal $d(n)$ (the signal measured at the system output in response to applying $x(n)$ at its input) is stored in the file dfile. First the variables for the adaptive IIR model $w(n)$ are created and initialized using init_sharf(), and the input signals are read from files, then a processing loop is started. In each iteration of the loop asptsharf() 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 $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/sharfsysid.eps,width=\textwidth}


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
L  = 5;                           % smoothing FIR length
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
u  = zeros(N+M,1);                % composite input vector
w  = u;                           % initial filter vector
c  = filter(.01,[1 -.99],ip(1:L));% error smoothing filter
e  = randn(L,1);                  % initial error vector
d  = randn(1,1);                  % initial desired sample
mu = [.01;0.01;.003;0.003] ;      % Step size vector
  
% Create and initialize EQERR IIR filter
[u,w,e,c,d,mu,Px,Py] = init_sharf(N,M,L,u,w,e,c,d,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 adaptive coefficients
   [w,u,y,e,Px,Py]=asptsharf(N,M,w,u,x,d,e,c,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(1),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
Figure 10.54: Performance of the SHARF IIR adaptive filter in a system identification application.
Running the above script will produce the graph shown in Fig. 10.54. The two top-left panels in Fig. 10.54 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.


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


See Also
INIT_ SHARF, ASPTSHARF.

Reference
[2] and [10] for introduction to recursive adaptive filters.


next up previous contents
Next: 28 model_ tdlms Up: 10 Applications and Examples Previous: 26 model_ rlslattice   Contents