Compute output, error, and weights using LMS adaptive algorithm
Filtering / Adaptive Filters
dspadpt3
The Block LMS Filter block implements an adaptive least meansquare
(LMS) filter, where the adaptation of filter weights occurs once for
every block of samples. The block estimates the filter weights, or
coefficients, needed to minimize the error, e(n),
between the output signal, y(n),
and the desired signal, d(n).
Connect the signal you want to filter to the Input port. The input
signal can be a scalar or a column vector. Connect the signal you
want to model to the Desired
port. The desired
signal must have the same data type, complexity, and dimensions as
the input signal. The Output
port outputs the filtered
input signal. The Error
port outputs the result
of subtracting the output signal from the desired signal.
The block calculates the filter weights using the Block LMS adaptive filter algorithm. This algorithm is defined by the following equations.
$$\begin{array}{c}n=kN+i\\ y(n)={w}^{T}(k1)u(n)\\ e(n)=d(n)y(n)\\ w(k)=w(k1)+f(u(n),\text{}e(n),\mu )\end{array}$$
The weight update function for the Block LMS adaptive filter algorithm is defined as
$$f(u(n),e(n),\mu )=\mu {\displaystyle \sum _{i=0}^{N1}{u}^{\ast}(kN+i)e(kN+i)}$$
The variables are as follows.
Variable  Description 

n  The current time index 
i  The iteration variable in each block, $$0\le i\le N1$$ 
k  The block number 
N  The block size 
u(n)  The vector of buffered input samples at step n 
w(n)  The vector of filtertap estimates at step n 
y(n)  The filtered output at step n 
e(n)  The estimation error at time n 
d(n)  The desired response at time n 
μ  The adaptation step size 
Use the Filter length parameter to specify the length of the filter weights vector.
The Block size parameter determines how many samples of the input signal are acquired before the filter weights are updated. The number of rows in the input must be an integer multiple of the Block size parameter.
The adaptation Stepsize (mu) parameter corresponds to µ in the equations. You can either specify a stepsize using the input port, Stepsize, or enter a value in the Block Parameters: Block LMS Filter dialog box.
Use the Leakage factor (0 to 1) parameter to specify the leakage factor, $$0<1\mu \alpha \le 1$$, in the leaky LMS algorithm shown below.
$$w(k)=(1\mu \alpha )w(k1)+f(u(n),e(n),\mu )$$
Enter the initial filter weights as a vector or a scalar in the Initial value of filter weights text box. When you enter 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
When you select the Adapt port check box,
an Adapt
port appears on the block. When the input
to this port is greater than zero, the block continuously updates
the filter weights. When the input to this port is zero, the filter
weights remain at their current values.
When you want to reset the value of the filter weights to their initial values, use the Reset input 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.
From the Reset input list, select None
to
disable the Reset port. To enable the Reset port, select one of the
following from the Reset input 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 (see the following figure).
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 (see the following figure)
Either edge
— Triggers
a reset operation when the Reset input is a Rising edge
or Falling
edge
(as described above)
Nonzero sample
—
Triggers a reset operation at each sample time that the Reset input
is not zero
Select the Output filter weights check
box to create a Wts
port on the block. For each
iteration, the block outputs the current updated filter weights from
this port.
Enter the length of the FIR filter weights vector.
Enter the number of samples to acquire before the filter weights are updated. The number of rows in the input must be an integer multiple of the Block size.
Select Dialog
to enter a value for
mu in the Block parameters: LMS Filter dialog box. Select Input
port
to specify mu using the Stepsize input port.
Enter the stepsize. Tunable (Simulink).
Enter the leakage factor, $$0<1\mu \alpha \le 1$$. Tunable (Simulink).
Specify the initial values of the FIR filter weights.
Select this check box to enable the Adapt input port.
Select this check box to enable the Reset input port.
Select this check box to export the filter weights from the Wts port.
Hayes, M. H. Statistical Digital Signal Processing and Modeling. New York: John Wiley & Sons, 1996.
Port  Supported Data Types 

Input 

Desired 

Stepsize 

Adapt 

Reset 

Output 

Error 

Wts 

Fast Block LMS Filter  DSP System Toolbox 
Kalman Adaptive Filter (Obsolete)  DSP System Toolbox 
LMS Filter  DSP System Toolbox 
RLS Filter  DSP System Toolbox 
See Adaptive Filters in Simulink for related information.