Filtered XLMS filter
dsp.FilteredXLMSFilter computes output,
error and coefficients using Filtered-X Least Mean Squares FIR adaptive
To implement the adaptive FIR filter object:
Starting in R2016b, instead of using the
to perform the operation defined by the System
object™, you can
call the object with arguments, as if it were a function. For example,
= step(obj,x) and
y = obj(x) perform
fxlms = dsp.FilteredXLMSFilter returns
a filtered-x Least Mean Square FIR adaptive filter System
object is used to compute the filtered output and
the filter error for a given input and desired signal.
fxlms = dsp.FilteredXLMSFilter(' returns
with each specified property set to the specified value.
fxlms= dsp.FilteredXLMSFilter(LEN,' returns
with the Length property set to
LEN, and other
specified properties set to the specified values. For the algorithm
on how to implement this filter, refer to , .
Length of filter coefficients vector
Specify the length of the FIR filter coefficients vector as a positive integer value. This property is nontunable.
The default value is 10.
Adaptation step size
Specify the adaptation step size factor as a positive numeric
scalar. The default value is
Adaptation leakage factor
Specify the leakage factor used in a leaky adaptive filter as
a numeric value between
Coefficients of the secondary path filter model
Specify the coefficients of the secondary path filter model as a numeric vector. The secondary path connects the output actuator and the error sensor. The default value is a vector that represents the coefficients of a 10th-order FIR lowpass filter. This property is tunable.
An estimate of the secondary path filter model
Specify the estimate of the secondary path filter model as a
numeric vector. The secondary path connects the output actuator and
the error sensor. The default value equals to the
Initial coefficients of the filter
Specify the initial values of the FIR adaptive filter coefficients
as a scalar or a vector of length equal to the value of the
This property is tunable.
Locked status of the coefficient updates
Specify whether to lock the filter coefficient values. By default,
the value of this property is
This property is tunable.
|msesim||Mean-square error for Filtered-X LMS filter|
|reset||Reset filter states for Filtered-X LMS filter|
|step||Apply Filtered-X LMS filter to input|
Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent
step syntax. For example, myObject(x) becomes step(myObject,x).
Generate noise, create FIR primary path system model, generate observation noise, filter the primary path system model output with added noise, and create FIR secondary path system model.
x = randn(1000,1); g = fir1(47,0.4); n = 0.1*randn(1000,1); d = filter(g,1,x) + n; b = fir1(31,0.5);
Use the Filtered-X LMS Filter to compute the filtered output and the filter error for the input and the signal to be cancelled.
mu = 0.008; fxlms = dsp.FilteredXLMSFilter(32, 'StepSize', mu, 'LeakageFactor', ... 1, 'SecondaryPathCoefficients', b); [y,e] = fxlms(x,d);
Plot the results.
plot(1:1000,d,'b',1:1000,e,'r'); title('Active Noise Control of a Random Noise Signal'); legend('Original','Attenuated'); xlabel('Time Index'); ylabel('Signal Value'); grid on;
 Kuo, S.M. and Morgan, D.R. Active Noise Control Systems: Algorithms and DSP Implementations. New York: John Wiley & Sons, 1996.
 Widrow, B. and Stearns, S.D. Adaptive Signal Processing. Upper Saddle River, N.J: Prentice Hall, 1985.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).