Engee documentation

RLS Filter

A recursive Least squares algorithm (RLS) for calculating the output signal, errors and weights.

blockType: RLSFilter

Path in the library:

/Signal Operations/Filters/Adaptive Filters/RLS Filter

Description

Block RLS Filter recursively calculates an estimate of the weighting coefficients of the FIR filter necessary to minimize the error between the output signal and the expected signal .

For more information, see [algorithms].

Ports

Input

# Input — Input signal
scalar | column vector

Details

An input signal specified as a scalar or column vector.

Data types

Float32, Float64

Complex numbers support

Yes

# Desired — the desired signal
scalar | column vector

Details

The desired signal, given as a scalar or column vector.

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

Data types

Float32, Float64

Complex numbers support

Yes

Output

# Output — evaluation of the desired signal
scalar | column vector

Details

An estimate of the desired signal, returned as a scalar or column vector. 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

Float32, Float64

Complex numbers support

Yes

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

Details

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

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

The purpose of the RLS filter is to minimize this error. The unit adapts its coefficients, aiming at their optimal values, which give an output signal that closely matches the desired signal.

Data types

Float32, Float64

Complex numbers support

Yes

# Wts — filter weights
scalar | column vector

Details

Filter weights returned as a scalar or column vector.

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

At each step, the block displays the current updated filter weights.

Data types

Float32, Float64

Complex numbers support

Yes

Parameters

Main

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

Details

The length of the vector of FIR filter coefficients in the form of a positive integer.

Default value

32

Program usage name

FilterLength

Tunable

No

Evaluatable

Yes

# Specify forgetting factor via — method for setting the forgetting coefficient
Dialog

Details

The coefficient of forgetting. Set as:

  • Dialog — the forgetting coefficient is indicated using the parameter Forgetting factor (0 to 1).

Values

Dialog

Default value

Dialog

Program usage name

SpecifyForgettingFactorVia

Tunable

No

Evaluatable

No

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

Details

The forgetting coefficient of the RLS algorithm , given as a scalar in the range .

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

Task means infinite memory, while the filter adapts the weights. As a rule, , where — filter length.

Default value

1.0

Program usage name

ForgettingFactor

Tunable

Yes

Evaluatable

Yes

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

Details

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

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

Default value

0.0

Program usage name

InitialValueOfFilterWeights

Tunable

No

Evaluatable

Yes

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

Details

Initial values of the estimate of the covariance of the input signal, in the form of:

  • Scalar — — this is a diagonal matrix with diagonal elements equal to a scalar value.

  • Square matrix — each dimension of the matrix is equal to the value in the parameter Filter length.

Initial value , where is the value specified in the parameter Initial input variance estimate.

Default value

0.1

Program usage name

InitialInputVarianceEstimate

Tunable

No

Evaluatable

Yes

# Reset port — reset port
None

Details

Enabling the reset port Reset. Set as None.

Values

None

Default value

None

Program usage name

ResetPort

Tunable

No

Evaluatable

No

Algorithms

Matrix expression of the RLS filter:













Where — the inverse of the exponential weighting factor.

The equations above use the following variables:

  • — current time index;

  • — a vector of buffered input samples per step ;

  • — the inverse covariance matrix in the step ;

  • — gain vector per step ;

  • — a vector of estimates of the filter coefficients at a step ;

  • — filtered signal in a step ;

  • — evaluation of the error in the step ;

  • — the expected signal at the step ;

  • — the coefficient of forgetting.

The implementation of the algorithm in the block is optimized by using the symmetry of the inverse covariance matrix . This reduces the total number of calculations by half.

Literature

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