| Filter Design Toolbox | ![]() |
adaptfilt.lms Example--System Identification
To use the adaptive filter functions in the toolbox you need to provide three things:
gremez is the unknown system.
adaptlms and initlms.
Start by defining an input signal x.
The input is broadband noise. For the unknown system filter, use gremez to create a twelfth-order lowpass filter:
Although you do not need them here, include the err and res output arguments.
Now filter the signal through the unknown system to get the desired signal.
With the unknown filter designed and the desired signal in place you construct and apply the adaptive LMS filter object to identify the unknown.
Preparing the adaptive filter object requires that you provide starting values for estimates of the filter coefficients and the LMS step size. You could start with estimated coefficients of some set of nonzero values; this example uses zeros for the 12 initial filter weights. For the step size, 0.8 is a reasonable value--a good compromise between being large enough to converge well within the 250 iterations (250 input sample points) and small enough to create an accurate estimate of the unknown filter.
Finally, using the adaptfilt object ha, desired signal, d, and the input to the filter, x, we run the adaptive filter to determine the unknown system and plot the results, comparing the actual coefficients from gremez to the coefficients found by adaptlms.
In the stem plot the actual and estimated filter weights are the same. As an experiment, try changing the step size to 0.2. Repeating the example with mu = 0.2 results in the following stem plot. The estimated weights fail to approximate the actual weights closely.
Since this may be because we did not iterate over the LMS algorithm enough times, try using 1000 samples. With 1000 samples, the stem plot, shown in the next figure, looks much better, albeit at the expense of much more computation. Clearly you should take care to select the step size with both the computation required and the fidelity of the estimated filter in mind.
| Examples of Adaptive Filters That Use LMS Algorithms | adaptfilt.nlms Example--System Identification | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |