Vous êtes sur la page 1sur 7

India

Contact Us
Store

Search

Create Account
Log In

Accelerating the pace of engineering and science

Products & Services


Solutions
Academia
Support
User Community
Events
Company

Documentation
Center

Trial Software
Product Updates
Share

Search R2013a D Search

DSP System Toolbox


Filter Implementation
Adaptive Filters

adaptfilt
Adaptive filter

Syntax
ha = adaptfilt.algorithm('input1',input2,...)
Description
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 forfilter.

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

Recursive Least Squares (RLS) Based FIR Adaptive Filters

Affine Projection (AP) FIR Adaptive Filters

FIR Adaptive Filters in the Frequency Domain (FD)

Lattice Based (L) FIR Adaptive Filters

Least Mean Squares (LMS) Based FIR Adaptive Filters


adaptfilt.algorithm String

Algorithm Used to Generate Filter Coefficients

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

Algorithm Used to Generate Filter Coefficients

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.algorithm String

Algorithm Used to Generate Filter Coefficients

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

Algorithm Used to Generate Filter Coefficients

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

Algorithm Used to Generate Filter Coefficients

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

Algorithm Used to Generate Filter Coefficients

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

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 overloadingand 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

Method

Description

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

Working with Adaptive Filter Objects


The next sections cover viewing and changing the properties of adaptfilt objects. Generally, modifying the
properties is the same foradaptfilt, dfilt, and mfilt 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

get(ha,'property')
To see all properties for an object, use

get(ha)
Changing Object Properties
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.

Copying an Object
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 y
change the characteristics of ha2, those of ha change as well.

Using Filter States


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.

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 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;

See Also
dfilt | filter | mfilt
Was this topic helpful?

Try MATLAB, Simulink, and Other Products


Get trial now

Join the conversation

Preventing Piracy
Privacy Policy
Trademarks
Patents
Site Help
1994-2013 The MathWorks, Inc.

Vous aimerez peut-être aussi