Main Content

Fast Block LMS Filter

Compute output, error, and weights using least mean squares (LMS) adaptive algorithm

  • Fast Block LMS Filter block

Libraries:
DSP System Toolbox / Filtering / Adaptive Filters

Description

The Fast Block LMS Filter block implements an adaptive least mean squares (LMS) filter, where the adaptation of the filter weights occurs once for every block of data samples. The block estimates the filter weights (also known as the coefficients) needed to minimize the error e(n) between the output signal y(n) and the desired signal d(n).

The Fast Block LMS Filter block uses the Block LMS Filter equations to estimate the filter weights. For more information, see Algorithms. The Fast Block LMS Filter block implements the convolution operation involved in the calculations of the filtered output and the weight update function in the frequency domain using the FFT algorithm used in the Frequency-Domain FIR Filter block.

For more information on adaptive filters, see Overview of Adaptive Filters and Applications.

Ports

Input

expand all

Specify the input signal you want to filter as a scalar or a column vector.

The input signal and the desired signal must have the same size, data type, and complexity.

The input frame length (number of rows in the input) must be an integer multiple of the value you specify in the Block size parameter.

Data Types: single | double
Complex Number Support: Yes

Specify the signal you want to model as a scalar or a column vector. The LMS filter adapts its coefficients to minimize the error and converge the input signal to the desired signal as closely as possible.

The input signal and the desired signal must have the same size, data type, and complexity.

Data Types: single | double
Complex Number Support: Yes

Specify the adaptation step size as a nonnegative scalar. The data type of the step size input must match the data type of the input signal and the desired signal.

A small step size ensures a small steady state error between the output signal and the desired signal. If the step size is small, the convergence speed of the filter decreases. To improve the convergence speed, increase the step size. Note that if the step size is large, the filter can become unstable.

Dependencies

To enable this port, set Specify step size via to 'Input port'.

Data Types: single | double

If the input is a nonzero value, the block continuously updates the filter weights. If the value of this input is zero, the filter weights remain at their current values.

Dependencies

To enable this port, select the Adapt port parameter.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean

Specify the reset signal as a scalar signal. When you want to reset the value of the filter weights to their initial values, use the Reset port parameter. The block resets the filter weights whenever a reset event is detected at the Reset port. The reset signal rate must be the same rate as the data signal input.

To enable the Reset port, select one of these options from the Reset port list:

  • Rising edge — Triggers a reset operation when the Reset input does one of the following:

    • Rises from a negative value to a positive value or zero

    • Rises from zero to a positive value, where the rise is not a continuation of a rise from a negative value to zero

  • Falling edge — Triggers a reset operation when the Reset input does one of the following:

    • Falls from a positive value to a negative value or zero

    • Falls from zero to a negative value, where the fall is not a continuation of a fall from a positive value to zero

  • Either edge — Triggers a reset operation when the Reset input is a Rising edge or Falling edge

  • Non-zero sample — Triggers a reset operation at each sample time that the Reset input is not zero

To disable the reset port, set Reset port to None.

Dependencies

To enable this port, set Reset port to any option other than None.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean

Output

expand all

Filtered signal, returned as a scalar or a column vector. The block adapts its filter coefficients to converge the input signal to match the desired signal. The filter outputs the converged signal.

Data Types: single | double
Complex Number Support: Yes

Difference between the filtered signal and the desired signal, returned as a scalar or a column vector. The objective of the LMS filter is to minimize this error. The block adapts its coefficients to converge towards optimal filter coefficients that produce an output signal that matches closely with the desired signal.

Data Types: single | double
Complex Number Support: Yes

Weights of the LMS filter, returned as a column vector of length equal to the value you specify in the Filter length parameter. For each iteration, the block outputs the current updated filter weights from this port.

The data type of the filter weights matches the data type of the filtered signal.

Dependencies

To enable this port, select the Output filter weights parameter.

Data Types: single | double
Complex Number Support: Yes

Parameters

expand all

Specify the length of the FIR filter coefficients vector as a positive integer. The sum of filter length and block length must be a power of 2.

Specify the number of samples of the input signal to acquire before the block updates the filter weights as a positive integer. The input frame length (number of rows in the input) must be an integer multiple of the value you specify in this parameter. The sum of filter length and block length must be a power of 2.

Specify the adaptation step size through:

  • Dialog –– Use the Step size (mu) parameter to specify the step size in the block dialog box.

  • Input port –– Use the Step-size input port to specify the step size.

Specify the adaptation step size µ as a nonnegative integer. You can specify the step size using the input port, Step-size, or enter a value in this parameter.

A small step size ensures a small steady state error between the output signal and the desired signal. If the step size is small, the convergence speed of the filter decreases. To improve the convergence speed, increase the step size. Note that if the step size is large, the filter can become unstable.

Tunable: Yes

Dependencies

To enable this parameter, set the Specify step size via parameter to Dialog.

Specify the leakage factor used in the leaky LMS algorithm shown below as a scalar in the range [0, 1], 0<1μα1.

w(k)=(1μα)w(k1)f(u(n),e(n),μ)

When the value is less than 1, the block implements a leaky LMS algorithm. The default is 1, providing no leakage in the adapting algorithm.

Tunable: Yes

Specify initial values of the filter weights w(0) as a scalar or a vector of length equal to the filter length. When you specify a scalar, the block uses the scalar value to create a vector of filter weights. This vector has length equal to the filter length and all of its values are equal to the scalar value.

Select this parameter to enable the Adapt input port. Use this port to specify if the block must update its filter weights or to keep them at the current level. For more information, see the description of the Adapt input port.

Select this parameter to enable the Reset input port. For more information on each of the reset options, see the description for the Reset input port.

Select this parameter to export the filter weights from the Wts port.

Block Characteristics

Data Types

double | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

References

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

Extended Capabilities

Version History

Introduced before R2006a