Engee documentation

RLS Filter

Recursive least squares (RLS) algorithm to compute the output, errors and weighting factors.

rls filter

Description

Block RLS Filter recursively calculates an estimate of the FIR filter weights required to minimise the error between the output signal and the expected signal .

For more information, see Sect. Extras.

Ports

Input

# Input — input signal
scalar | vector-column

Details

An input signal specified as a scalar or column vector.

Data types

Single | Float64.

Complex numbers support

Yes

# Desired — desired signal
scalar | vector-column

Details

The desired signal specified as a scalar or vector-column.

The desired signal must have the same data type, complexity and dimensions as the signal on the Input port.

Data types

Single | Float64.

Complex numbers support

Yes

Output

# Output — desired signal estimation
scalar | vector-column

Details

An estimate of the desired signal returned as a scalar or vector-column. It has the same size and complexity as the input signal.

The output signal has the same data type as the desired signal.

Data types

Single | Float64.

Complex numbers support

Yes

# Error — Error between output and desired signals
scalar | vector-column

Details

The error between the output and desired signals, returned as a scalar or column vector.

The error signal has the same data type as the desired signal.

The goal of the RLS filter is to minimise this error. The block adapts its coefficients, aiming for their optimal values that give an output signal that closely matches the desired signal.

Data types

Single | Float64.

Complex numbers support

Yes

# Wts — filter weights
scalar | vector-column

Details

Filter weights returned as scalar or vector-columns.

The output signal has the same length as specified in the Filter length parameters.

At each step the block outputs the current updated filter weights.

Data types

Single | Float64.

Complex numbers support

Yes

Parameters

Main

# Filter length — length of the vector of FIR filter coefficients
Int64 integer

Details

FIR filter coefficient vector length as a positive integer.

Default value

32

Program usage name

FilterLength

Tunable

No

Evaluatable

Yes

# Specify forgetting factor via — method of setting the forgetting rate
Dialog

Details

Forgetting rate. Defined as:

  • Dialog - the forgetting factor is specified via the Forgetting factor (0 to 1) parameter.

Values

Dialog

Default value

Dialog

Program usage name

SpecifyForgettingFactorVia

Tunable

No

Evaluatable

No

# Forgetting factor (0 to 1) — forgetting factor of the RLS algorithm
Real number

Details

RLS algorithm forgetting factor λ , specified as a scalar in the range .

This parameters determines how quickly the filter forgets information about the previous count.

Setting λ means infinite memory, with the filter adapting the weighting coefficients. Typically, , where is the length of the filter.

Default value

1.0

Program usage name

ForgettingFactor

Tunable

Yes

Evaluatable

Yes

# Initial value of filter weights — initial value of filter weights
Scalar / array of real and/or complex numbers

Details

Initial values of FIR filter weight coefficients , given as a scalar or vector with length equal to the filter length.

If the value is a scalar, the block uses the scalar value to create a vector of filter weight coefficients. This vector has a length equal to the filter length and all its values are equal to the scalar value.

Default value

0.0

Program usage name

InitialValueOfFilterWeights

Tunable

No

Evaluatable

Yes

# Initial input variance estimate — initial estimate of input data covariance
Real number

Details

Initial values of the input covariance estimate, 1/P(n) in the form:

  • Scalar - P(n) is a diagonal matrix with diagonal elements equal to the scalar value.

  • Square matrix - each dimension of the matrix is equal to the value in the Filter length parameters.

Initial value P(n)= , where the value is specified in the Initial input variance estimate parameters.

Default value

0.1

Program usage name

InitialInputVarianceEstimate

Tunable

No

Evaluatable

Yes

# Reset port — reset port
None

Details

Enables the Reset reset port. Defined as:

  • None.

Values

None

Default value

None

Program usage name

ResetPort

Tunable

No

Evaluatable

No

Extras

*Algorithms.

Matrix expression of the RLS filter:













where is the inverse of the exponential weighting factor.

The value of the variables is presented in the table:

Variable

Description

Index of the current time

Vector of buffered input samples at step

Inverse covariance matrix at step

Vector of gain at a step

Vector of filter coefficient estimates at a step

Filtered signal at a step

Error estimate at step

Expected signal at step

Forgetting coefficient

The implementation of the algorithm in block is optimised by usage of the symmetry of the inverse covariance matrix P(n). This reduces the total number of computations by half.

Literature

  1. Hayes, M.H.. "Statistical Digital Signal Processing and Modeling." New York: John Wiley & Sons, 1996.

See also