Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Compute output, error and coefficients using recursive least squares (RLS) algorithm

The `dsp.RLSFilter`

System
object™ filters each channel of the input using RLS filter implementations.

To filter each channel of the input:

Create the

`dsp.RLSFilter`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

`rlsFilt = dsp.RLSFilter`

`rlsFilt = dsp.RLSFilter(len)`

`rlsFilt = dsp.RLSFilter(Name,Value)`

returns an adaptive
RLS filter System
object, `rlsFilt`

= dsp.RLSFilter`rlsFilt`

. This System
object computes the filtered output, filter error, and the filter weights for a
given input and desired signal using the RLS algorithm.

returns an RLS filter System
object, `rlsFilt`

= dsp.RLSFilter(`len`

)`rlsFilt`

. This System
object has the `Length`

property set to
`len`

.

returns an RLS filter System
object with each specified property set to the specified value. Enclose each
property name in single quotes. Unspecified properties have default values.`rlsFilt`

= dsp.RLSFilter(`Name,Value`

)

**For versions earlier than R2016b, use the step
function to run the System object algorithm. The arguments to
step are the object you created, followed by
the arguments shown in this section.**

**For example, y = step(obj,x) and y = obj(x) perform equivalent operations.**

`y = rlsFilt(x,d)`

```
[y,e] =
rlsFilt(x,d)
```

`[`

shows the output of the RLS filter along with the error, `y`

,`e`

] =
rlsFilt(`x`

,`d`

)`e`

, between
the reference input and the desired signal. The filters adapts its coefficients until the
error `e`

is minimized. You can access these coefficients by accessing
the `Coefficients`

property of the object. This can be done only after
calling the object. For example, to access the optimized coefficients of the
`rlsFilt`

filter, call `rlsFilt.Coefficients`

after
you pass the input and desired signal to the object.

To use an object function, specify the
System
object as the first input argument. For
example, to release system resources of a System
object named `obj`

, use
this syntax:

release(obj)

The `dsp.RLSFilter`

System
object, when `Conventional RLS`

is selected, recursively
computes the least squares estimate (RLS) of the FIR filter weights.
The System
object estimates the filter weights or coefficients,
needed to convert the input signal into the desired signal. The input
signal can be a scalar or a column vector. The desired signal must
have the same data type, complexity, and dimensions as the input signal.
The corresponding RLS filter is expressed in matrix form as **P**(*n*)
:

$$\begin{array}{l}k(n)=\frac{{\lambda}^{-1}P(n-1)u(n)}{1+{\lambda}^{-1}{u}^{H}(n)P(n-1)u(n)}\\ y(n)={w}^{T}(n-1)u(n)\\ e(n)=d(n)-y(n)\\ w(n)=w(n-1)+k(n)e(n)\\ P(n)={\lambda}^{-1}P(n-1)-{\lambda}^{-1}k(n){u}^{H}(n)P(n-1)\end{array}$$

where λ^{-1} denotes the reciprocal
of the exponential weighting factor. The variables are as follows:

Variable | Description |
---|---|

n | The current time index |

u(n) | The vector of buffered input samples at step n |

P(n) | The inverse correlation matrix at step n |

k(n) | The gain vector at step n |

w(n) | The vector of filter tap estimates at step n |

y(n) | The filtered output at step n |

e(n) | The estimation error at step n |

d(n) | The desired response at step n |

λ | The forgetting factor |

**u**, **w**, and **k** are
all column vectors.

[1] M Hayes, *Statistical Digital Signal Processing and
Modeling,* New York: Wiley, 1996.

[2] S. Haykin, *Adaptive Filter Theory,* 4th
Edition, Upper Saddle River, NJ: Prentice Hall, 2002 .

[3] A.A. Rontogiannis and S. Theodoridis, "Inverse factorization
adaptive least-squares algorithms," *Signal Processing*, vol. 52, no. 1,
pp. 35-47, July 1996.

[4] S.C. Douglas, "Numerically-robust O(N^{2})
RLS algorithms using least-squares prewhitening," Proc. IEEE Int.
Conf. on Acoustics, Speech, and Signal Processing, Istanbul, Turkey,
vol. I, pp. 412-415, June 2000.

[5] A. H. Sayed, *Fundamentals of Adaptive
Filtering,* Hoboken, NJ: John Wiley & Sons, 2003.