Documentation |
The LMSFilter implements an adaptive FIR filter object that returns the filtered output, the error vector, and filter weights. The LMS filter uses one of five different LMS algorithms.
To implement the adaptive FIR filter object:
Define and set up your adaptive FIR filter object. See Construction.
Call step to implement the filter according to the properties of dsp.LMSFilter. The behavior of step is specific to each object in the toolbox.
H = dsp.LMSFilter returns an adaptive FIR filter object, H, that computes the filtered output, filter error and the filter weights for a given input and desired signal using the Least Mean Squares (LMS) algorithm.
H = dsp.LMSFilter('PropertyName', PropertyValue,...) returns an LMS filter object, H, with each property set to the specified value.
H = dsp.LMSFilter(LEN,'PropertyName',PropertyValue,...) returns an LMS filter object, H, with the Length property set to LEN, and other specified properties set to the specified values.
Method |
Method to calculate filter weights Specify the method used to calculate filter weights as LMS, Normalized LMS, Sign-Error LMS, Sign-Data LMS, or Sign-Sign LMS. The default is LMS. |
Length |
Length of FIR filter weights vector Specify the length of the FIR filter weights vector as a positive integer. The default is 32. |
StepSizeSource |
How to specify adaptation step size Choose how to specify the adaptation step size factor as Property or Input port. The default is Property. |
StepSize |
Adaptation step size Specify the adaptation step size factor as a nonnegative real number. For convergence of the normalized LMS method, set the step size greater than 0 and less than 2. This property only applies when the StepSizeSource property is Property. The default is 0.1. This property is tunable. |
LeakageFactor |
Leakage factor used in LMS filter Specify the leakage factor as a real number between 0 and 1 inclusive. A leakage factor of 1 corresponds to no leakage in the adapting method. The default is 1. This property is tunable. |
InitialConditions |
Initial conditions of filter weights Specify the initial values of the FIR filter weights as a scalar or vector of length equal to the Length property value. The default is 0. |
AdaptInputPort |
Enable weight adaptation Specify when the LMS filter should adapt the filter weights. By default, the value of this property is false, and the object continuously updates the filter weights. When this property is set to true, an adaptation control input is provided to the step method. If the value of this input is nonzero, the object continuously updates the filter weights. If the input is zero, the filter weights remain at their current value. |
WeightsResetInputPort |
Enable weight reset Specify when the LMS filter should reset the filter weights. By default, the value of this property is false, and the object does not reset the weights. When this property is set to true, a reset control input is provided to the step method, and the WeightsResetCondition property applies. The object resets the filter weights based on the values of the WeightsResetCondition property and the reset input to the step method. |
WeightsResetCondition |
Reset trigger setting for filter weights Specify the event to reset the filter weights as Rising edge, Falling edge, Either edge, or Non-zero. The LMS filter resets the filter weights based on the values of this property and the reset input to the step method. This property only applies when the WeightsResetInputPort property is true. The default is Non-zero. |
WeightsOutputPort |
Enable returning filter weights Set this property to true to output the adapted filter weights. The default is true. |
clone | Create LMS filter object with same property values |
getNumInputs | Number of expected inputs to step method |
getNumOutputs | Number of outputs of step method |
isLocked | Locked status for input attributes and nontunable properties |
maxstep | Maximum step size for LMS adaptive filter convergence |
msepred | Predicted mean-square error for LMS filter |
msesim | Mean-squared error for LMS filter |
release | Allow property value and input characteristics changes |
reset | Reset filter states for LMS filter |
step | Apply LMS adaptive filter to input |
This filter's algorithm is defined by the following equations.
$$\begin{array}{c}y(n)={w}^{T}(n-1)u(n)\\ e(n)=d(n)-y(n)\\ w(n)=\alpha w(n-1)+f(u(n),e(n),\mu )\end{array}$$
The various LMS adaptive filter algorithms available in this System object™ are defined as:
LMS:
$$f(u(n),e(n),\mu )=\mu e(n){u}^{*}(n)$$
Normalized LMS:
$$f(u(n),e(n),\mu )=\mu e(n)\frac{{u}^{\ast}(n)}{\epsilon +{u}^{H}(n)u(n)}$$
Sign-Error LMS:
$$f(u(n),e(n),\mu )=\mu sign(e(n))u*(n)$$
Sign-Data LMS:
$$f(u(n),e(n),\mu )=\mu e(n)sign(u(n))$$
where u(n) is real.
Sign-Sign LMS:
$$f(u(n),e(n),\mu )=\mu sign(e(n))sign(u(n))$$
where u(n) is real.
The variables are as follows:
Variable | Description |
---|---|
n | The current time index |
u(n) | The vector of buffered input samples at step n |
u*(n) | The complex conjugate of the vector of buffered input samples at step n |
w(n) | The vector of filter weight 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 adaptation step size |
α | The leakage factor (0 < α ≤ 1) |