| Filter Design Toolbox | ![]() |
Construct an adaptive filter object
Syntax
Description
ha = adaptfilt. returns the adaptive filter object algorithm('input1',input2,...)
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.
Algorithms
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.
Least Mean Squares (LMS) Based FIR Adaptive Filters
| adaptfilt.algorithm String |
Description of the Adapting Algorithm Used to Generate Filter Coefficients During Adaptation |
adaptfilt.adjlms |
Use the Adjoint LMS FIR adaptive filter algorithm |
adaptfilt.blms |
Use the Block LMS FIR adaptive filter algorithm |
adaptfilt.blmsfft |
Use the FFT-based Block LMS FIR adaptive filter algorithm |
adaptfilt.dlms |
Use the delayed LMS FIR adaptive filter algorithm |
adaptfilt.filtxlms |
Use the filtered-x LMS FIR adaptive filter algorithm |
adaptfilt.lms |
Use the LMS FIR adaptive filter algorithm |
adaptfilt.nlms |
Use the normalized LMS FIR adaptive filter algorithm |
adaptfilt.sd |
Use the sign-data LMS FIR adaptive filter algorithm |
adaptfilt.se |
Use the sign-error LMS FIR adaptive filter algorithm |
adaptfilt.ss |
Use the sign-sign LMS FIR adaptive filter algorithm |
For further information about an adapting algorithm, refer to the reference page for the algorithm.
Recursive Least Squares (RLS) Based FIR Adaptive Filters
| adaptfilt.algorithm String |
Description of the Adapting Algorithm Used to Generate Filter Coefficients During Adaptation |
adaptfilt.ftf |
Use the fast transversal least squares adaptation algorithm |
adaptfilt.qrdrls |
Use the QR-decomposition RLS adaptation algorithm |
adaptfilt.hrls |
Use the householder RLS adaptation algorithm |
adaptfilt.hswrls |
Use the householder SWRLS adaptation algorithm |
adaptfilt.rls |
Use the recursive-least squares (RLS) adaptation algorithm |
adaptfilt.swrls |
Use the sliding window (SW) RLS adaptation algorithm |
adaptfilt.swftf |
Use the sliding window FTF adaptation algorithm |
For more complete information about an adapting algorithm, refer to the reference page for the algorithm.
Affine Projection (AP) FIR Adaptive Filters
| adaptfilt.algorithm String |
Description of the Adapting Algorithm Used to Generate Filter Coefficients During Adaptation |
adaptfilt.ap |
Use the affine projection algorithm that uses direct matrix inversion |
adaptfilt.apru |
Use the affine projection algorithm that uses recursive matrix updating |
adaptfilt.bap |
Use the block affine projection adaptation algorithm |
To find more information about an adapting algorithm, refer to the reference page for the algorithm.
FIR Adaptive Filters in the Frequency Domain (FD)
| adaptfilt.algorithm String |
Description of the Adapting Algorithm Used to Generate Filter Coefficients During Adaptation |
adaptfilt.fdaf |
Use the frequency domain adaptation algorithm |
adaptfilt.pbfdaf |
Use the partition block version of the FDAF algorithm |
adaptfilt.pbufdaf |
Use the partition block unconstrained version of the FDAF algorithm |
adaptfilt.tdafdct |
Use the transform domain adaptation algorithm using DCT |
adaptfilt.tdafdft |
Use the transform domain adaptation algorithm using DFT |
adaptfilt.ufdaf |
Use the unconstrained FDAF algorithm for adaptation |
For more information about an adapting algorithm, refer to the reference page for the algorithm.
Lattice Based (L) FIR Adaptive Filters
| adaptfilt.algorithm String |
Description of the Adapting Algorithm Used to Generate Filter Coefficients During Adaptation |
adaptfilt.gal |
Use the gradient adaptive lattice filter adaptation algorithm |
adaptfilt.lsl |
Use the least squares lattice adaptation algorithm |
adaptfilt.qrdlsl |
Use the QR decomposition least squares lattice adaptation algorithm |
For more information about an adapting algorithm, refer to the reference page for the algorithm.
Properties for all Adaptive Filter Objects
Each reference page for an algorithm and adaptfilt.algorithm object specifies which properties apply to the adapting algorithm and how to use them.
Methods for Adaptive Filter Objects
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
to lauch FVTool and work with your object.
Some methods share their names with functions in the Signal Processing Toolbox, 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 is many toolboxes.
Working with Adaptive Filter Objects
The next sections cover viewing and changing the properties of adaptfilt objects. Generally, modifying the properties is the same for adaptfit, dfilt, mfilt, and qfilt objects and most of the same methods apply to all.
Viewing Object Properties
As with any object, you can use get to view a adaptfilt object's properties. To see a specific property, use
To see all properties for an object, use
Changing Object Properties
To set specific properties, use
You must use single quotation marks around the property name so MATLAB treats them as strings.
Copying an Object
To create a copy of an object, use copy.
Note
Using the syntax ha2 = ha copies only the object handle and does not create a new object. When you change the characteristics of ha2, those of ha change as well--ha and ha2 are not independent.
|
Using Filter States
Two properties control your adaptive filter states.
ResetBeforeFiltering--resets the filter before filtering. The default value is 'on' 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 ResetBeforeFiltering to 'off' allows the object to retain its current properties between filtering operations, rather than resetting the filter to its property values at construction.
Examples
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 filterb = fir1(31,0.5); % FIR system to be identifiedn = 0.1*randn(1,500); % Observation noise signald = filter(b,1,x)+n; % Desired signalmu = 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;
Glancing at the figure shows you the coefficients after adapting closely match the desired unknown FIR filter.
See Also
| Functions--Alphabetical List | adaptfilt.adjlms | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |