next up previous contents
Next: 3 asptouterr Up: 6 Recursive Adaptive Algorithms Previous: 1 asptcsoiir2   Contents


2 aspteqerr

Purpose
Sample per sample filtering and coefficient update using the Equation Error recursive adaptive algorithm. The filter transfer function is given by
\begin{displaymath}
H(z) = \frac{A(z)}{1-B(z)},
\end{displaymath} (48)


Syntax
[u,w,y,e,Px,Pd]=aspteqerr(N,M,u,w,y,x,d,mu,Px,Pd)

Description
aspteqerr() implements the equation error LMS adaptive algorithm used to update recursive adaptive filters. The equation error algorithm adjusts the composite filter coefficients vector by minimizing the error signal as shown in Fig. 6.3. aspteqerr() takes an input sample $x(n)$, a desired sample $d(n)$, the vector of the adaptive filter coefficients from previous iteration $w(n-1)$, the composite input vector $u(n-1)$, the step size vector $mu$, and returns the filter output $y(n)$, the error sample $e(n)$ and the updated vector of filter coefficients $w(n)$. The input and output parameters of aspteqerr() for a recursive adaptive filter of $N$ numerator coefficients and $M$ denumerator coefficients are summarized below.
Input arguments:
   N   : Number of coefficients of A(z)
   M   : Number of coefficients of B(z)
   u   : composite input vector
   w   : filter coefficient vector
   y   : [y(n-1) y(n-2) ... y(n-M)]^T
   x   : new input sample
   d   : new desired sample
   mu  : adaptation constant
   Px  : variance of x(n)
   Pd  : variance of d(n)
Output Parameters:
   u,w,y,Px,Py are the updated variables defined above
   e   : error signal e(n)



Figure 6.3: Block diagram of the equation error algorithm.


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



Example
Figure 6.4: The adaptive filter impulse response after convergence and the learning curve for the IIR system identification problem using the equation error algorithm.
iter = 5000;                    % Number of samples to process
xn   = 2*(rand(iter,1)-0.5)  ;  % Input signal, zero mean random.
dn   = filter([0.6 -.01],[1 -0.4 0.6],xn); % Filter output 
en   = zeros(iter,1);           % error signal

% Initialize EQERR 
N = 2; M = 2;
[u,w,y,e,mu,Px,Pd]=init_eqerr(N,M); 

%% Processing Loop
for (m=1:iter)
   x = xn(m);
   d = dn(m) + 1e-3*rand;   
   % update the filter
   [u,w,y,e,Px,Pd]=aspteqerr(N,M,u,w,y,x,d,mu,Px,Pd);   
   % save the last error sample to plot later
   en(m,:) = e;  
end;

wp = filter(w(1:N),[1 ; -w(N+1:N+M)],[1;zeros(19,1)]);

% display the results
subplot(2,2,1);stem(wp); grid;
xlabel('filter response after convergence')
subplot(2,2,2);
eb = filter(0.1,[1 -.9], en .* conj(en));
plot(10*log10(eb  ));grid
Running the above script will produce the graph shown in Fig. 6.4. The left side graph of the figure shows the adaptive filter impulse response after convergence. The right side graph shows the mean square error in dB versus time during the adaptation process, which is usually called the learning curve. The lower limit of the error signal power in the learning curve is defined here by the additive white noise added at the filter output (-60 dB).


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

Algorithm
The equation error algorithm uses the desired signal $d(n)$ (instead of the output signal $y(n)$ as in the output error algorithm) as input to the recursive part of the filter. This makes the performance index function quadratic in the filter coefficients and results in a single global minimum similar to that found in FIR adaptive algorithms. The filter transfer function is given by
\begin{displaymath}
w(z) = \frac{A(z)}{1-B(z)}
\end{displaymath} (49)

where


$\displaystyle A(z)$ $\textstyle =$ $\displaystyle a_0 + a_1 z^{-1} + ... + a_{N-1} z^{-N+1}$ (50)
$\displaystyle B(z)$ $\textstyle =$ $\displaystyle b_1 z^{-1} + b_2 z^{-2} + ... + b_M z^{-M}$ (51)

The current implementation of aspteqerr() performs the following operations
  • Updates the composite input vector $\vu (n)$ using the current and previous samples of $x(n)$ and $d(n)$.
  • Filters the composite input vector $\vu (n)$ through the adaptive filter coefficients $\vw (n-1)$ to produce the update filter output $y_1(n)$.
  • Calculates the error sample $e(n) = d(n) - y_1(n)$.
  • Calculates the actual filter output $y(n)$ as shown in Fig. 6.3
  • Updates the adaptive filter coefficients using the error $e(n)$ and the composite input vector $\vu (n)$ using the relationship
    \begin{displaymath}
\vw (n) = \vw (n-1) + 2 \; \mu \; e(n) \; \vu (n-1).
\end{displaymath} (52)


Remarks
  • Being an IIR filter, the adaptive filter $w(n)$ might become unstable during adaptation. This can be avoided by checking that the poles of the filter remain within the unit circle after each call to aspteqerr().
  • Unlike the output error algorithm, the performance surface searched by the equation error algorithm is quadratic in the filter coefficients and has a single minimum. This guarantees that the filter will asymptotically converge to its optimal solution.
  • aspteqerr() supports both real and complex data and filters.
  • aspteqerr() updates the composite input vector internally.



Resources
The resources required to implement the EQERR algorithm for a recursive adaptive filter of $N$ numerator coefficients and $M$ denumerator coefficients in real time is given in the table below. The computations given are those required to process one sample.


MEMORY $3N + 4M + 4$
MULTIPLY $4N + 5M + 6$
ADD $3N + 4M + 1$
DIVIDE N+M


See Also
INIT_ EQERR, MODEL_ EQERR, ASPTOUTERR.

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

next up previous contents
Next: 3 asptouterr Up: 6 Recursive Adaptive Algorithms Previous: 1 asptcsoiir2   Contents