Documentation Center |
Adaptive filter
ha = adaptfilt.algorithm('input1',input2,...)
ha = adaptfilt.algorithm('input1',input2,...) returns the adaptive filter object ha that uses the adaptive filtering technique specified by algorithm. When you construct an adaptive filter object, include an algorithm specifier to implement a specific adaptive filter. Note that you do not enclose the algorithm option in single quotation marks as you do for most strings. To construct an adaptive filter object you must supply an algorithm string — there is no default algorithm, although every constructor creates a default adaptive filter when you do not provide input arguments such as input1 or input2 in the calling syntax.
For information on how to run data through your adaptive filter object, see the Adaptive Filter Syntaxes section of the reference page for filter.
For adaptive filter (adaptfilt) objects, the algorithm string determines which adaptive filter algorithm your adaptfilt object implements. Each available algorithm entry appears in one of the tables along with a brief description of the algorithm. Click on the algorithm in the first column to get more information about the associated adaptive filter technique.
adaptfilt.algorithm String | Algorithm Used to Generate Filter Coefficients |
---|---|
Use the Adjoint LMS FIR adaptive filter algorithm | |
Use the Block LMS FIR adaptive filter algorithm | |
Use the FFT-based Block LMS FIR adaptive filter algorithm | |
Use the delayed LMS FIR adaptive filter algorithm | |
Use the filtered-x LMS FIR adaptive filter algorithm | |
Use the LMS FIR adaptive filter algorithm | |
Use the normalized LMS FIR adaptive filter algorithm | |
Use the sign-data LMS FIR adaptive filter algorithm | |
Use the sign-error LMS FIR adaptive filter algorithm | |
Use the sign-sign LMS FIR adaptive filter algorithm |
For further information about an adapting algorithm, refer to the reference page for the algorithm.
adaptfilt.algorithm String | Algorithm Used to Generate Filter Coefficients |
---|---|
Use the fast transversal least squares adaptation algorithm | |
Use the QR-decomposition RLS adaptation algorithm | |
Use the householder RLS adaptation algorithm | |
Use the householder SWRLS adaptation algorithm | |
Use the recursive-least squares (RLS) adaptation algorithm | |
Use the sliding window (SW) RLS adaptation algorithm | |
Use the sliding window FTF adaptation algorithm |
For more complete information about an adapting algorithm, refer to the reference page for the algorithm.
adaptfilt.algorithm String | Algorithm Used to Generate Filter Coefficients |
---|---|
Use the affine projection algorithm that uses direct matrix inversion | |
Use the affine projection algorithm that uses recursive matrix updating | |
Use the block affine projection adaptation algorithm |
To find more information about an adapting algorithm, refer to the reference page for the algorithm.
adaptfilt.algorithm String | Algorithm Used to Generate Filter Coefficients |
---|---|
Use the frequency domain adaptation algorithm | |
Use the partition block version of the FDAF algorithm | |
Use the partition block unconstrained version of the FDAF algorithm | |
Use the transform domain adaptation algorithm using DCT | |
Use the transform domain adaptation algorithm using DFT | |
Use the unconstrained FDAF algorithm for adaptation |
For more information about an adapting algorithm, refer to the reference page for the algorithm.
adaptfilt.algorithm String | Algorithm Used to Generate Filter Coefficients |
---|---|
Use the gradient adaptive lattice filter adaptation algorithm | |
Use the least squares lattice adaptation algorithm | |
Use the QR decomposition least squares lattice adaptation algorithm |
For more information about an adapting algorithm, refer to the reference page for the algorithm.
Each reference page for an algorithm and adaptfilt.algorithm object specifies which properties apply to the adapting algorithm and how to use them.
As is true with all objects, methods enable you to perform various operations on adaptfilt objects. To use the methods, you apply them to the object handle that you assigned when you constructed the adaptfilt object.
Most of the analysis methods that apply to dfilt objects also work with adaptfilt objects. Methods like freqz rely on the filter coefficients in the adaptfilt object. Since the coefficients change each time the filter adapts to data, you should view the results of using a method as an analysis of the filter at a moment in time for the object. Use caution when you apply an analysis method to your adaptive filter objects — always check that your result approached your expectation.
In particular, the Filter Visualization Tool (FVTool) supports all of the adaptfilt objects. Analyzing and viewing your adaptfilt objects is straightforward — use the fvtool method with the name of your object
fvtool(objectname)
to launch FVTool and work with your object.
Some methods share their names with functions in Signal Processing Toolbox™ software, or even functions in this toolbox. Functions that share names with methods behave in a similar way. Using the same name for more than one function or method is called overloading and is common in many toolboxes.
Method | Description |
---|---|
adaptfilt/coefficients | Return the instantaneous adaptive filter coefficients |
adaptfilt/filter | Apply an adaptfilt object to your signal |
adaptfilt/freqz | Plot the instantaneous adaptive filter frequency response |
adaptfilt/grpdelay | Plot the instantaneous adaptive filter group delay |
adaptfilt/impz | Plot the instantaneous adaptive filter impulse response. |
adaptfilt/info | Return the adaptive filter information. |
adaptfilt/isfir | Test whether an adaptive filter is an finite impulse response (FIR) filters. |
adaptfilt/islinphase | Test whether an adaptive filter is linear phase |
adaptfilt/ismaxphase | Test whether an adaptive filter is maximum phase |
adaptfilt/isminphase | Test whether an adaptive filter is minimum phase |
adaptfilt/isreal | True whether an adaptive filter has real coefficients |
adaptfilt/isstable | Test whether an adaptive filter is stable |
adaptfilt/maxstep | Return the maximum step size for an adaptive filter |
adaptfilt/msepred | Return the predicted mean square error |
adaptfilt/msesim | Return the measured mean square error via simulation. |
adaptfilt/phasez | Plot the instantaneous adaptive filter phase response |
adaptfilt/reset | Reset an adaptive filter to initial conditions |
adaptfilt/stepz | Plot the instantaneous adaptive filter step response |
adaptfilt/tf | Return the instantaneous adaptive filter transfer function |
adaptfilt/zerophase | Plot the instantaneous adaptive filter zerophase response |
adaptfilt/zpk | Return a matrix containing the instantaneous adaptive filter zero, pole, and gain values |
adaptfilt/zplane | Plot the instantaneous adaptive filter in the Z-plane |
The next sections cover viewing and changing the properties of adaptfilt objects. Generally, modifying the properties is the same for adaptfilt, dfilt, and mfilt objects and most of the same methods apply to all.
As with any object, you can use get to view a adaptfilt object's properties. To see a specific property, use
get(ha,'property')
To see all properties for an object, use
get(ha)
To set specific properties, use
set(ha,'property1',value1,'property2',value2,...)
You must use single quotation marks around the property name so MATLAB treats them as strings.
To create a copy of an object, use copy.
ha2 = copy(ha)
Note Using the syntax ha2 = ha copies only the object handle and does not create a new object — ha and ha2 are not independent. When you change the characteristics of ha2, those of ha change as well. |
Two properties control your adaptive filter states.
States — stores the current states of the filter. Before the filter is applied, the states correspond to the initial conditions and after the filter is applied, the states correspond to the final conditions.
PersistentMemory — resets the filter before filtering. The default value is false which causes the properties that are modified by the filter, such as coefficients and states, to be reset to the value you specified when you constructed the object, before you use the object to filter data. Setting PersistentMemory to true allows the object to retain its current properties between filtering operations, rather than resetting the filter to its property values at construction.
Construct an LMS adaptive filter object and use it to identify an unknown system. For this example, use 500 iteration of the adapting process to determine the unknown filter coefficients. Using the LMS algorithm represents one of the most straightforward technique for adaptive filters.
x = randn(1,500); % Input to the filter b = fir1(31,0.5); % FIR system to be identified n = 0.1*randn(1,500); % Observation noise signal d = filter(b,1,x)+n; % Desired signal mu = 0.008; % LMS step size. ha = adaptfilt.lms(32,mu); [y,e] = filter(ha,x,d); subplot(2,1,1); plot(1:500,[d;y;e]); title('System Identification of an FIR Filter'); legend('Desired','Output','Error'); xlabel('Time Index'); ylabel('Signal Value'); subplot(2,1,2); stem([b.',ha.coefficients.']); legend('Actual','Estimated'); xlabel('Coefficient #'); ylabel('Coefficient Value'); grid on;