Accelerating the pace of engineering and science

# Documentation Center

• Trials

FIR adaptive filter that uses QR-decomposition-based RLS

## Description

ha = adaptfilt.qrdrls(l,lambda,sqrtcov,coeffs,states) constructs an FIR QR-decomposition-based recursive-least squares (RLS) adaptive filter object ha.

For information on how to run data through your adaptive filter object, see the Adaptive Filter Syntaxes section of the reference page for filter.

### Input Arguments

Entries in the following table describe the input arguments for adaptfilt.qrdrls.

Input Argument

Description

l

Adaptive filter length (the number of coefficients or taps) and it must be a positive integer.l defaults to 10.

lambda

RLS forgetting factor. This is a scalar and should lie within the range (0, 1]. lambda defaults to 1.

sqrtcov

Upper-triangular Cholesky (square root) factor of the input covariance matrix. Initialize this matrix with a positive definite upper triangular matrix.

coeffs

Vector of initial filter coefficients. It must be a length l vector. coeffs defaults to length l vector whose elements are zeros.

states

Vector of initial filter states. It must be a length l-1 vector. states defaults to a length l-1 vector of zeros.

## Properties

Since your adaptfilt.qrdrls filter is an object, it has properties that define its behavior in operation. Note that many of the properties are also input arguments for creating adaptfilt.qrdrls objects. To show you the properties that apply, this table lists and describes each property for the filter object.

Name

Range

Description

Algorithm

None

Coefficients

Vector of length l

Vector containing the initial filter coefficients. It must be a length l vector where l is the number of filter coefficients. coeffs defaults to length l vector of zeros when you do not provide the argument for input.

FilterLength

Any positive integer

Reports the length of the filter, the number of coefficients or taps

ForgettingFactor

Scalar

Forgetting factor of the adaptive filter. This is a scalar and should lie in the range (0, 1]. It defaults to 1. Setting forgetting factor = 1 denotes infinite memory while adapting to find the new filter. Note that this is the lambda input argument.

PersistentMemory

false or true

Determine whether the filter states get restored to their starting values for each filtering operation. The starting values are the values in place when you create the filter if you have not changed the filter since you constructed it. PersistentMemory returns to zero any state that the filter changes during processing. States that the filter does not change are not affected. Defaults to false.

SqrtCov

Square matrix with each dimension equal to the filter length l

Upper-triangular Cholesky (square root) factor of the input covariance matrix. Initialize this matrix with a positive definite upper triangular matrix.

States

Vector of elements

Vector of the adaptive filter states. states defaults to a vector of zeros which has length equal to (l + projectord - 2).

## Examples

System Identification of a 32-coefficient FIR filter (500 iterations).

```x  = randn(1,500);       % Input to the filter
b  = fir1(31,0.5);       % FIR system to be identified
n  = 0.1*randn(1,500);   % Observation noise signal
d  = filter(b,1,x)+n;    % Desired signal
G0 = sqrt(.1)*eye(32);   % Initial sqrt correlation matrix
lam = 0.99;              % RLS forgetting factor
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,1,2); stem([b.',ha.Coefficients.']);
legend('Actual','Estimated'); grid on;
xlabel('Coefficient #'); ylabel('Coefficient Value');```

Using this variant of the RLS algorithm successfully identifies the unknown FIR filter, as shown here.