Filter Design Toolbox Reference Guide.pdf

1418
Filter Design Toolbox™ 4 Reference Guide

Transcript of Filter Design Toolbox Reference Guide.pdf

  • Filter Design Toolbox 4Reference Guide

  • How to Contact The MathWorks

    www.mathworks.com Webcomp.soft-sys.matlab Newsgroupwww.mathworks.com/contact_TS.html Technical [email protected] Product enhancement [email protected] Bug [email protected] Documentation error [email protected] Order status, license renewals, [email protected] Sales, pricing, and general information

    508-647-7000 (Phone)

    508-647-7001 (Fax)

    The MathWorks, Inc.3 Apple Hill DriveNatick, MA 01760-2098For contact information about worldwide offices, see the MathWorks Web site.Filter Design Toolbox Reference Guide COPYRIGHT 20002010 by The MathWorks, Inc.The software described in this document is furnished under a license agreement. The software may be usedor copied only under the terms of the license agreement. No part of this manual may be photocopied orreproduced in any form without prior written consent from The MathWorks, Inc.FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentationby, for, or through the federal government of the United States. By accepting delivery of the Programor Documentation, the government hereby agrees that this software or documentation qualifies ascommercial computer software or commercial computer software documentation as such terms are usedor defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms andconditions of this Agreement and only those rights specified in this Agreement, shall pertain to and governthe use, modification, reproduction, release, performance, display, and disclosure of the Program andDocumentation by the federal government (or other entity acquiring for or through the federal government)and shall supersede any conflicting contractual terms or conditions. If this License fails to meet thegovernments needs or is inconsistent in any respect with federal procurement law, the government agreesto return the Program and Documentation, unused, to The MathWorks, Inc.

    Trademarks

    MATLAB and Simulink are registered trademarks of The MathWorks, Inc. Seewww.mathworks.com/trademarks for a list of additional trademarks. Other product or brandnames may be trademarks or registered trademarks of their respective holders.Patents

    The MathWorks products are protected by one or more U.S. patents. Please seewww.mathworks.com/patents for more information.

  • Revision HistoryMarch 2007 Online only New for Version 4.1 (Release 2007a)September 2007 Online only New for Version 4.2 (Release 2007b)March 2008 Online only New for Version 4.3 (Release 2008a)October 2008 Online only New for Version 4.4 (Release 2008b)March 2009 Online only New for Version 4.5 (Release 2009a)September 2009 Online only New for Version 4.6 (Release 2009b)March 2010 Online only New for Version 4.7 (Release 2010a)

  • Contents

    Function Reference1

    Adaptive Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2Least Mean Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2Recursive Least Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3Affine Projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3Frequency Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4Lattice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4

    Discrete-Time Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5

    Filter Specifications Response Types . . . . . . . . . . . . . 1-7

    Filter Specifications Design Methods . . . . . . . . . . . . . 1-9

    Multirate Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10

    GUIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11

    Filter Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12

    Fixed-Point Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15

    Quantized Filter Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 1-16

    SOS Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-17

    Filter Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18

    Filter Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-19

    v

  • Functions Alphabetical List

    2

    Reference for the Properties of Filter Objects

    3Fixed-Point Filter Properties . . . . . . . . . . . . . . . . . . . . . . . 3-2Overview of Fixed-Point Filters . . . . . . . . . . . . . . . . . . . . . . 3-2Fixed-Point Objects and Filters . . . . . . . . . . . . . . . . . . . . . . 3-2Summary Fixed-Point Filter Properties . . . . . . . . . . . . . 3-5Property Details for Fixed-Point Filters . . . . . . . . . . . . . . . 3-18

    Adaptive Filter Properties . . . . . . . . . . . . . . . . . . . . . . . . . . 3-102Property Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-102Property Details for Adaptive Filter Properties . . . . . . . . . 3-107

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-115

    Multirate Filter Properties . . . . . . . . . . . . . . . . . . . . . . . . . 3-116Property Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-116Property Details for Multirate Filter Properties . . . . . . . . . 3-121

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-132

    Index

    vi Contents

  • 1Function Reference

    Adaptive Filters (p. 1-2) Design adaptive filtersDiscrete-Time Filters (p. 1-5) Design FIR and IIR discrete-time

    filter objectsFilter Specifications ResponseTypes (p. 1-7)

    Create objects that specify filterresponses

    Filter Specifications DesignMethods (p. 1-9)

    Design filter objects fromspecification objects

    Multirate Filters (p. 1-10) Design multirate filter objectsGUIs (p. 1-11) Use graphical user interface tools to

    design filtersFilter Analysis (p. 1-12) Analyze filters and filter objectsFixed-Point Filters (p. 1-15) Create fixed-point filtersQuantized Filter Analysis (p. 1-16) Analyze fixed-point filtersSOS Conversion (p. 1-17) Work with second-order section

    filtersFilter Design (p. 1-18) Design filters (not object-based)Filter Conversion (p. 1-19) Transform filters to other forms,

    or use features in filter to developanother filter

  • 1 Function Reference

    Adaptive Filters

    Least Mean Squares (p. 1-2) Filter with LMS techniquesRecursive Least Squares (p. 1-3) Filter with RLS techniquesAffine Projection (p. 1-3) Filter with affine projectionFrequency Domain (p. 1-4) Filter in the frequency domainLattice (p. 1-4) Filter with lattice filters

    Least Mean Squares

    adaptfilt.adjlms FIR adaptive filter that uses adjointLMS algorithm

    adaptfilt.blms FIR adaptive filter that uses BLMSadaptfilt.blmsfft FIR adaptive filter that uses

    FFT-based BLMSadaptfilt.dlms FIR adaptive filter that uses delayed

    LMSadaptfilt.filtxlms FIR adaptive filter that uses

    filtered-x LMSadaptfilt.lms FIR adaptive filter that uses LMSadaptfilt.nlms FIR adaptive filter that uses NLMSadaptfilt.sd FIR adaptive filter that uses

    sign-data algorithmadaptfilt.se FIR adaptive filter that uses

    sign-error algorithmadaptfilt.ss FIR adaptive filter that uses

    sign-sign algorithm

    1-2

  • Adaptive Filters

    Recursive Least Squares

    adaptfilt.ftf Fast transversal LMS adaptive filteradaptfilt.hrls FIR adaptive filter that uses

    householder (RLS)adaptfilt.hswrls FIR adaptive filter that uses

    householder sliding window RLSadaptfilt.qrdrls FIR adaptive filter that uses

    QR-decomposition-based RLSadaptfilt.rls FIR adaptive filter that uses direct

    form RLSadaptfilt.swftf FIR adaptive filter that uses sliding

    window fast transversal leastsquares

    adaptfilt.swrls FIR adaptive filter that uses windowrecursive least squares (RLS)

    Affine Projection

    adaptfilt.ap FIR adaptive filter that uses directmatrix inversion

    adaptfilt.apru FIR adaptive filter that usesrecursive matrix updating

    adaptfilt.bap FIR adaptive filter that uses blockaffine projection

    1-3

  • 1 Function Reference

    Frequency Domain

    adaptfilt.fdaf FIR adaptive filter that usesfrequency-domain with bin step sizenormalization

    adaptfilt.pbfdaf FIR adaptive filter that usesPBFDAF with bin step sizenormalization

    adaptfilt.pbufdaf FIR adaptive filter that usesPBUFDAF with bin step sizenormalization

    adaptfilt.tdafdct Adaptive filter that uses discretecosine transform

    adaptfilt.tdafdft Adaptive filter that uses discreteFourier transform

    adaptfilt.ufdaf FIR adaptive filter that usesunconstrained frequency-domainwith quantized step sizenormalization

    Lattice

    adaptfilt.gal FIR adaptive filter that usesgradient lattice

    adaptfilt.lsl Adaptive filter that uses LSLadaptfilt.qrdlsl Adaptive filter that uses

    QR-decomposition-based LSL

    1-4

  • Discrete-Time Filters

    Discrete-Time Filtersdfilt Discrete-time filterdfilt.allpass Allpass filterdfilt.calattice Coupled-allpass, lattice filterdfilt.calatticepc Coupled-allpass,

    power-complementary lattice filterdfilt.cascade Cascade of discrete-time filtersdfilt.cascadeallpass Cascade of allpass discrete-time

    filtersdfilt.cascadewdfallpass Cascade allpass WDF filters to

    construct allpass WDFdfilt.delay Delay filterdfilt.df1 Discrete-time, direct-form I filterdfilt.df1sos Discrete-time, SOS direct-form I

    filterdfilt.df1t Discrete-time, direct-form I

    transposed filterdfilt.df1tsos Discrete-time, SOS direct-form I

    transposed filterdfilt.df2 Discrete-time, direct-form II filterdfilt.df2sos Discrete-time, SOS, direct-form II

    filterdfilt.df2t Discrete-time, direct-form II

    transposed filterdfilt.df2tsos Discrete-time, SOS direct-form II

    transposed filterdfilt.dfasymfir Discrete-time, direct-form

    antisymmetric FIR filterdfilt.dffir Discrete-time, direct-form FIR filter

    1-5

  • 1 Function Reference

    dfilt.dffirt Discrete-time, direct-form FIRtransposed filter

    dfilt.dfsymfir Discrete-time, direct-form symmetricFIR filter

    dfilt.farrowfd Fractional Delay Farrow filterdfilt.farrowlinearfd Farrow Linear Fractional Delay

    filterdfilt.fftfir Discrete-time, overlap-add, FIR

    filterdfilt.latticeallpass Discrete-time, lattice allpass filterdfilt.latticear Discrete-time, lattice, autoregressive

    filterdfilt.latticearma Discrete-time, lattice,

    autoregressive, moving-averagefilter

    dfilt.latticemamax Discrete-time, lattice,moving-average filter withmaximumphase

    dfilt.latticemamin Discrete-time, lattice,moving-average filter with minimumphase

    dfilt.parallel Discrete-time, parallel structurefilter

    dfilt.scalar Discrete-time, scalar filterdfilt.wdfallpass Wave digital allpass filter

    1-6

  • Filter Specifications Response Types

    Filter Specifications Response Typesfdesign Filter specification objectfdesign.arbmag Arbitrary response magnitude filter

    specification objectfdesign.arbmagnphase Arbitrary response magnitude and

    phase filter specification objectfdesign.audioweighting Audio weighting filter specification

    objectfdesign.bandpass Bandpass filter specification objectfdesign.bandstop Bandstop filter specification objectfdesign.ciccomp CIC compensator filter specification

    objectfdesign.comb IIR comb filter specification objectfdesign.decimator Decimator filter specification objectfdesign.differentiator Differentiator filter specification

    objectfdesign.fracdelay Fractional delay filter specification

    objectfdesign.halfband Halfband filter specification objectfdesign.highpass Highpass filter specification objectfdesign.hilbert Hilbert filter specification objectfdesign.interpolator Interpolator filter specificationfdesign.isinclp Inverse-sinc filter specificationfdesign.lowpass Lowpass filter specificationfdesign.notch Notch filter specificationfdesign.nyquist Nyquist filter specificationfdesign.octave Octave filter specificationfdesign.parameq Parametric equalizer filter

    specification

    1-7

  • 1 Function Reference

    fdesign.peak Peak filter specificationfdesign.polysrc Construct polynomial sample-rate

    converter (POLYSRC) filter designerfdesign.pulseshaping Pulse-shaping filter specification

    objectfdesign.rsrc Rational-factor sample-rate

    converter specification

    1-8

  • Filter Specifications Design Methods

    Filter Specifications Design Methodsbutter Butterworth IIR filter design using

    specification objectcheby1 Chebyshev Type I filter using

    specification objectcheby2 Chebyshev Type II filter using

    specification objectdesignmethods Methods available for designing

    filter from specification objectellip Elliptic filter using specification

    objectequiripple Equiripple single-rate or multirate

    FIR filter from specification objectfircls FIR Constrained Least Squares filterifir Interpolated FIR filter from filter

    specificationiirlinphase Quasi-linear phase IIR filter from

    halfband filter specificationkaiserwin Kaiser window filter from

    specification objectmaxflat Maxflat FIR filtermultistage Multistage filter from specification

    objectwindow FIR filter using windowed impulse

    response

    1-9

  • 1 Function Reference

    Multirate Filtersmfilt.cascade Cascade filter objectsmfilt.cicdecim Fixed-point CIC decimatormfilt.cicinterp Fixed-point CIC interpolatormfilt.farrowsrc Sample rate converter with arbitrary

    conversion factormfilt.fftfirinterp Overlap-add FIR polyphase

    interpolatormfilt.firdecim Direct-form FIR polyphase decimatormfilt.firfracdecim Direct-form FIR polyphase fractional

    decimatormfilt.firfracinterp Direct-form FIR polyphase fractional

    interpolatormfilt.firinterp FIR filter-based interpolatormfilt.firsrc Direct-form FIR polyphase sample

    rate convertermfilt.firtdecim Direct-form transposed FIR filtermfilt.holdinterp FIR hold interpolatormfilt.iirdecim IIR decimatormfilt.iirinterp IIR interpolatormfilt.iirwdfdecim IIR wave digital filter decimatormfilt.iirwdfinterp IIR wave digital filter interpolatormfilt.linearinterp Linear interpolator

    1-10

  • GUIs

    GUIsfdatool Open Filter Design and Analysis

    Toolfilterbuilder GUI-based filter design

    1-11

  • 1 Function Reference

    Filter Analysisautoscale Automatic dynamic range scalingblock Generate block from multirate filtercoeffs Coefficients for filterscost Cost of using discrete-time or

    multirate filtercumsec Vector of SOS filters for cumulative

    sectionsdenormalize Undo filter coefficient and gain

    changes caused by normalizedesignmethods Methods available for designing

    filter from specification objectdesignopts Valid input arguments and values

    for specification object and methoddisp Filter properties and valuesdouble Cast fixed-point filter to use

    double-precision arithmeticeuclidfactors Euclid factors for multirate filterfftcoeffs Frequency-domain coefficientsfilter Filter data with filter objectfiltstates.cic Store CIC filter statesfirtype Type of linear phase FIR filterfreqrespest Estimate fixed-point filter frequency

    response through filteringfreqrespopts freqrespest parameters and valuesfreqsamp Real or complex frequency-sampled

    FIR filter from specification objectfreqz Frequency response of filtergrpdelay Filter group delay

    1-12

  • Filter Analysis

    help Help for design method with filterspecification

    impz Filter impulse responseisfir Determine whether filter is FIRislinphase Determine whether filter is linear

    phaseismaxphase Determine whether filter is

    maximum phaseisminphase Determine whether filter is

    minimum phaseisreal Determine whether filter uses real

    coefficientsisstable Determine whether filter is stablelimitcycle Response of single-rate, fixed-point

    IIR filtermaxstep Maximum step size for adaptive

    filter convergencemeasure Measure filter magnitude responsemsepred Predicted mean-squared error for

    adaptive filtermsesim Measured mean-squared error for

    adaptive filternoisepsd Power spectral density of filter

    outputnoisepsdopts Options for running filter output

    noise PSDnorm P-norm of filternormalize Normalize filter numerator or

    feed-forward coefficientsnormalizefreq Switch filter specification between

    normalized frequency and absolutefrequency

    1-13

  • 1 Function Reference

    nstates Number of filter statesorder Order of fixed-point filterphasedelay Phase delay of filterphasez Unwrapped phase response for filterpolyphase Polyphase decomposition of

    multirate filterqreport Most recent fixed-point filtering

    operation reportrealizemdl Simulink subsystem block for filterreffilter Reference filter for fixed-point or

    single-precision filterreorder Rearrange sections in SOS filterreset Reset filter properties to initial

    conditionsscale Scale sections of SOS filterscalecheck Check scaling of SOS filterset2int Configure filter for integer filteringsetspecs Specifications for filter specification

    objectspecifyall Fixed-point scaling modes in

    direct-form FIR filterstepz Step response for filtervalidstructures Structures for specification object

    with design methodzerophase Zero-phase response for filterzplane Zero-pole plot for filter

    To see the full listing of analysis methods that apply to the adaptfilt, dfilt,or mfilt objects, enter help adaptfilt, help dfilt, or help mfilt at theMATLAB prompt.

    1-14

  • Fixed-Point Filters

    Fixed-Point Filterscell2sos Convert cell array to SOS matrixget Properties of quantized filterisreal Test if filter coefficients are realreset Reset properties of quantized filter

    to initial valuesscale Scale sections of SOS filtersscalecheck Check scaling of SOS filterscaleopts Scaling options for second-order

    section scalingset Properties of quantized filtersos Convert quantized filter to SOS

    form, order, and scalesos2cell Convert SOS matrix to cell array

    1-15

  • 1 Function Reference

    Quantized Filter Analysisfreqz Frequency response of filterimpz Filter impulse responseisallpass Determine whether filter is allpassisfir Determine whether filter is FIRislinphase Determine whether filter is linear

    phaseismaxphase Determine whether filter is

    maximum phaseisminphase Determine whether filter is

    minimum phaseisreal Determine whether filter uses real

    coefficientsissos Determine whether filter is SOS

    formisstable Determine whether filter is stablenoisepsd Power spectral density of filter

    outputnoisepsdopts Options for running filter output

    noise PSDzplane Zero-pole plot for filter

    1-16

  • SOS Conversion

    SOS Conversioncell2sos Convert a cell array to a second-order

    sections matrixsos Convert a quantized filter to

    second-order sections form, order,and scale

    sos2cell Convert a second-order sectionsmatrix to a cell array

    1-17

  • 1 Function Reference

    Filter Designfarrow Farrow filterfdatool Open Filter Design and Analysis

    Toolfilterbuilder GUI-based filter designfircband Constrained-band equiripple FIR

    filterfirceqrip Constrained, equiripple FIR filterfireqint Equiripple FIR interpolatorsfirgr Parks-McClellan FIR filterfirhalfband Halfband FIR filterfirlpnorm Least P-norm optimal FIR filterfirls Least square linear-phase FIR filter

    designfirminphase Minimum-phase FIR spectral factorfirnyquist Lowpass Nyquist (Lth-band) FIR

    filterifir Interpolated FIR filter from filter

    specificationiircomb IIR comb notch or peak filteriirgrpdelay Optimal IIR filter with prescribed

    group-delayiirlpnorm Least P-norm optimal IIR filteriirlpnormc Constrained least Pth-norm optimal

    IIR filteriirnotch Second-order IIR notch filteriirpeak Second-order IIR peak or resonator

    filter

    1-18

  • Filter Conversion

    Filter Conversionca2tf Convert coupled allpass filter to

    transfer function formcl2tf Convert coupled allpass lattice to

    transfer function formconvert Convert filter structure of

    discrete-time or multirate filterfirlp2hp Convert FIR lowpass filter to Type I

    FIR highpass filterfirlp2lp Convert FIR Type I lowpass to

    FIR Type 1 lowpass with inversebandwidth

    iirlp2bp Transform IIR lowpass filter to IIRbandpass filter

    iirlp2bs Transform IIR lowpass filter to IIRbandstop filter

    iirlp2hp Transform lowpass IIR filter tohighpass filter

    iirlp2lp Transform lowpass IIR filter todifferent lowpass filter

    iirpowcomp Power complementary IIR filterset2int Configure filter for integer filteringtf2ca Transfer function to coupled allpasstf2cl Transfer function to coupled allpass

    lattice

    1-19

  • 1 Function Reference

    1-20

  • 2Functions AlphabeticalList

  • adaptfilt

    Purpose Adaptive filter

    Syntax ha = adaptfilt.algorithm('input1',input2,...)

    Description ha = adaptfilt.algorithm('input1',input2,...) returns theadaptive filter object ha that uses the adaptive filtering techniquespecified 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 quotationmarks as you do for most strings. To construct an adaptive filter objectyou must supply an algorithm string there is no default algorithm,although every constructor creates a default adaptive filter when you donot provide input arguments such as input1 or input2 in the callingsyntax.

    Algorithms

    For adaptive filter (adaptfilt) objects, the algorithm stringdetermines which adaptive filter algorithm your adaptfilt objectimplements. Each available algorithm entry appears in one of the tablesalong with a brief description of the algorithm. Click on the algorithm inthe first column to get more information about the associated adaptivefilter technique.

    Least Mean Squares (LMS) Based FIR Adaptive Filters on page 2-3 Recursive Least Squares (RLS) Based FIR Adaptive Filters onpage 2-4

    Affine Projection (AP) FIR Adaptive Filters on page 2-4 FIR Adaptive Filters in the Frequency Domain (FD) on page 2-5 Lattice Based (L) FIR Adaptive Filters on page 2-5

    2-2

  • adaptfilt

    Least Mean Squares (LMS) Based FIR Adaptive Filters

    adaptfilt.algorithmString

    Algorithm Used to Generate FilterCoefficients

    adaptfilt.adjlms Use the Adjoint LMS FIR adaptive filteralgorithm

    adaptfilt.blms Use the Block LMS FIR adaptive filteralgorithm

    adaptfilt.blmsfft Use the FFT-based Block LMS FIRadaptive filter algorithm

    adaptfilt.dlms Use the delayed LMS FIR adaptive filteralgorithm

    adaptfilt.filtxlms Use the filtered-x LMS FIR adaptivefilter algorithm

    adaptfilt.lms Use the LMS FIR adaptive filteralgorithm

    adaptfilt.nlms Use the normalized LMS FIR adaptivefilter algorithm

    adaptfilt.sd Use the sign-data LMS FIR adaptivefilter algorithm

    adaptfilt.se Use the sign-error LMS FIR adaptivefilter algorithm

    adaptfilt.ss Use the sign-sign LMS FIR adaptive filteralgorithm

    For further information about an adapting algorithm, refer to thereference page for the algorithm.

    2-3

  • adaptfilt

    Recursive Least Squares (RLS) Based FIR Adaptive Filters

    adaptfilt.algorithmString

    Algorithm Used to Generate FilterCoefficients

    adaptfilt.ftf Use the fast transversal least squaresadaptation algorithm

    adaptfilt.qrdrls Use the QR-decomposition RLS adaptationalgorithm

    adaptfilt.hrls Use the householder RLS adaptationalgorithm

    adaptfilt.hswrls Use the householder SWRLS adaptationalgorithm

    adaptfilt.rls Use the recursive-least squares (RLS)adaptation algorithm

    adaptfilt.swrls Use the sliding window (SW) RLS adaptationalgorithm

    adaptfilt.swftf Use the sliding window FTF adaptationalgorithm

    For more complete information about an adapting algorithm, refer tothe reference page for the algorithm.

    Affine Projection (AP) FIR Adaptive Filters

    adaptfilt.algorithmString

    Algorithm Used to Generate FilterCoefficients

    adaptfilt.ap Use the affine projection algorithm that usesdirect matrix inversion

    adaptfilt.apru Use the affine projection algorithm that usesrecursive matrix updating

    adaptfilt.bap Use the block affine projection adaptationalgorithm

    2-4

  • adaptfilt

    To find more information about an adapting algorithm, refer to thereference page for the algorithm.

    FIR Adaptive Filters in the Frequency Domain (FD)

    adaptfilt.algorithmString

    Algorithm Used to Generate FilterCoefficients

    adaptfilt.fdaf Use the frequency domain adaptationalgorithm

    adaptfilt.pbfdaf Use the partition block version of the FDAFalgorithm

    adaptfilt.pbufdaf Use the partition block unconstrained versionof the FDAF algorithm

    adaptfilt.tdafdct Use the transform domain adaptationalgorithm using DCT

    adaptfilt.tdafdft Use the transform domain adaptationalgorithm using DFT

    adaptfilt.ufdaf Use the unconstrained FDAF algorithm foradaptation

    For more information about an adapting algorithm, refer to thereference page for the algorithm.

    Lattice Based (L) FIR Adaptive Filters

    adaptfilt.algorithmString

    Algorithm Used to Generate FilterCoefficients

    adaptfilt.gal Use the gradient adaptive lattice filteradaptation algorithm

    adaptfilt.lsl Use the least squares lattice adaptationalgorithm

    adaptfilt.qrdlsl Use the QR decomposition least squares latticeadaptation algorithm

    2-5

  • adaptfilt

    For more information about an adapting algorithm, refer to thereference page for the algorithm.

    Properties for All Adaptive Filter Objects

    Each reference page for an algorithm and adaptfilt.algorithm objectspecifies which properties apply to the adapting algorithm and howto use them.

    Methods for Adaptive Filter Objects

    As is true with all objects, methods enable you to perform variousoperations on adaptfilt objects. To use the methods, you apply themto the object handle that you assigned when you constructed theadaptfilt object.Most of the analysis methods that apply to dfilt objects also work withadaptfilt objects. Methods like freqz rely on the filter coefficients inthe adaptfilt object. Since the coefficients change each time the filteradapts to data, you should view the results of using a method as ananalysis of the filter at a moment in time for the object. Use cautionwhen 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 theadaptfilt objects. Analyzing and viewing your adaptfilt objects isstraightforward 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 ProcessingToolbox software, or even functions in this toolbox. Functions thatshare names with methods behave in a similar way. Using the samename for more than one function or method is called overloading and iscommon in many toolboxes.

    2-6

  • adaptfilt

    Method Description

    adaptfilt/coefficients Return the instantaneous adaptivefilter coefficients

    adaptfilt/filter Apply an adaptfilt object to yoursignal

    adaptfilt/freqz Plot the instantaneous adaptive filterfrequency response

    adaptfilt/grpdelay Plot the instantaneous adaptive filtergroup delay

    adaptfilt/impz Plot the instantaneous adaptive filterimpulse 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

    phaseadaptfilt/ismaxphase Test whether an adaptive filter is

    maximum phaseadaptfilt/isminphase Test whether an adaptive filter is

    minimum phaseadaptfilt/isreal True whether an adaptive filter has real

    coefficientsadaptfilt/isstable Test whether an adaptive filter is stableadaptfilt/maxstep Return the maximum step size for an

    adaptive filteradaptfilt/msepred Return the predicted mean square erroradaptfilt/msesim Return the measured mean square error

    via simulation.

    2-7

  • adaptfilt

    Method Description

    adaptfilt/phasez Plot the instantaneous adaptive filterphase response

    adaptfilt/reset Reset an adaptive filter to initialconditions

    adaptfilt/stepz Plot the instantaneous adaptive filterstep response

    adaptfilt/tf Return the instantaneous adaptivefilter transfer function

    adaptfilt/zerophase Plot the instantaneous adaptive filterzerophase response

    adaptfilt/zpk Return a matrix containing theinstantaneous adaptive filter zero, pole,and gain values

    adaptfilt/zplane Plot the instantaneous adaptive filterin the Z-plane

    Working with Adaptive Filter Objects

    The next sections cover viewing and changing the properties ofadaptfilt objects. Generally, modifying the properties is the same foradaptfilt, dfilt, and mfilt objects and most of the same methodsapply to all.

    Viewing Object Properties

    As with any object, you can use get to view a adaptfilt objectsproperties. To see a specific property, use

    get(ha,'property')

    To see all properties for an object, use

    get(ha)

    2-8

  • adaptfilt

    Changing Object Properties

    To set specific properties, use

    set(ha,'property1',value1,'property2',value2,...)

    You must use single quotation marks around the property name soMATLAB 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 doesnot create a new object ha and ha2 are not independent. When youchange 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 isapplied, the states correspond to the initial conditions and after thefilter is applied, the states correspond to the final conditions.

    PersistentMemory resets the filter before filtering. The defaultvalue is false which causes the properties that are modified by thefilter, such as coefficients and states, to be reset to the value youspecified when you constructed the object, before you use the objectto filter data. Setting PersistentMemory to true allows the objectto retain its current properties between filtering operations, ratherthan resetting the filter to its property values at construction.

    Examples Construct an LMS adaptive filter object and use it to identify anunknown system. For this example, use 500 iteration of the adaptingprocess to determine the unknown filter coefficients. Using the LMS

    2-9

  • adaptfilt

    algorithm represents one of the most straightforward technique foradaptive 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;

    Glancing at the figure shows you the coefficients after adapting closelymatch the desired unknown FIR filter.

    2-10

  • adaptfilt

    0 50 100 150 200 250 300 350 400 450 5003

    2

    1

    0

    1

    2System Identification of an FIR Filter

    Time Index

    Sign

    al V

    alue

    DesiredOutputError

    0 5 10 15 20 25 30 350.1

    0

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    Coefficient #

    Coef

    ficie

    nt V

    alue

    ActualEstimated

    See Also dfilt, filter, mfilt

    2-11

  • adaptfilt.adjlms

    Purpose FIR adaptive filter that uses adjoint LMS algorithm

    Syntax ha = adaptfilt.adjlms(l,step,leakage,pathcoeffs,pathest,...errstates,pstates,coeffs,states)

    Description ha = adaptfilt.adjlms(l,step,leakage,pathcoeffs,pathest,...errstates,pstates,coeffs,states) constructs object ha, an FIRadjoint LMS adaptive filter. l is the adaptive filter length (the numberof coefficients or taps) and must be a positive integer. l defaults to10 when you omit the argument. step is the adjoint LMS step size.It must be a nonnegative scalar. When you omit the step argument,step defaults to 0.1.leakage is the adjoint LMS leakage factor. It must be a scalar between0 and 1. When leakage is less than one, you implement a leaky versionof the adjlms algorithm to determine the filter coefficients. leakagedefaults to 1 specifying no leakage in the algorithm.pathcoeffs is the secondary path filter model. This vector shouldcontain the coefficient values of the secondary path from the outputactuator to the error sensor.pathest is the estimate of the secondary path filter model. pathestdefaults to the values in pathcoeffs.errstates is a vector of error states of the adaptive filter. It must havea length equal to the filter order of the secondary path model estimate.errstates defaults to a vector of zeros of appropriate length. pstatescontains the secondary path FIR filter states. It must be a vector oflength equal to the filter order of the secondary path model. pstatesdefaults to a vector of zeros of appropriate length. The initial filtercoefficients for the secondary path filter compose vector coeffs. It mustbe a length l vector. coeffs defaults to a length l vector of zeros.states is a vector containing the initial filter states. It must be a vectorof length l+ne-1, where ne is the length of errstates. When you omitstates, it defaults to an appropriate length vector of zeros.

    2-12

  • adaptfilt.adjlms

    Properties In the syntax for creating the adaptfilt object, the input options areproperties of the object created. This table lists the properties for theadjoint LMS object, their default values, and a brief description of theproperty.

    Property Default Value Description

    Algorithm None Specifies the adaptive filter algorithmthe object uses during adaptation

    Coefficients Length l vector withzeros for all elements

    Adjoint LMS FIR filter coefficients.Should be initialized with theinitial coefficients for the FIR filterprior to adapting. You need lentries in coefficients. Updatedfilter coefficients are returned incoefficients when you use s as anoutput argument.

    ErrorStates [0,...,0] A vector of the error states for youradaptive filter, with length equal to theorder of your secondary path filter.

    FilterLength 10 The number of coefficients in youradaptive filter.

    Leakage 1 Specifies the leakage parameter.Allows you to implement a leakyalgorithm. Including a leakage factorcan improve the results of the algorithmby forcing the algorithm to continue toadapt even after it reaches a minimumvalue. Ranges between 0 and 1.

    SecondaryPathCoeffs No default A vector that contains the coefficientvalues of your secondary path from theoutput actuator to the error sensor.

    SecondaryPathEstimate pathcoeffs values An estimate of the secondary path filtermodel.

    2-13

  • adaptfilt.adjlms

    Property Default Value Description

    SecondaryPathStates Length of thesecondary path filter.All elements arezeros.

    The states of the secondary path filter,the unknown system

    States l+ne+1, where ne islength(errstates)

    Contains the initial conditions for youradaptive filter and returns the statesof the FIR filter after adaptation. Ifomitted, it defaults to a zero vector oflength equal to l+ne+1. When you useadaptfilt.adjlms in a loop structure,use this element to specify the initialfilter states for the adapting FIR filter.

    Stepsize 0.1 Sets the adjoint LMS algorithm stepsize used for each iteration of theadapting algorithm. Determinesboth how quickly and how closely theadaptive filter converges to the filtersolution.

    PersistentMemory false or true Determine whether the filter statesget restored to their starting values foreach filtering operation. The startingvalues are the values in place when youcreate the filter. PersistentMemoryreturns to zero any state that the filterchanges during processing. Statesthat the filter does not change are notaffected. Defaults to false.

    Example Demonstrate active noise control of a random noise signal that runs for1000 samples.

    x = randn(1,1000); % Noise source

    g = fir1(47,0.4); % FIR primary path system model

    2-14

  • adaptfilt.adjlms

    n = 0.1*randn(1,1000); % Observation noise signal

    d = filter(g,1,x)+n; % Signal to be canceled (desired)

    b = fir1(31,0.5); % FIR secondary path system model

    mu = 0.008; % Adjoint LMS step size

    ha = adaptfilt.adjlms(32,mu,1,b);

    [y,e] = filter(ha,x,d);

    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;

    Reviewing the figure shows that the adaptive filter attenuates theoriginal noise signal as you expect.

    0 100 200 300 400 500 600 700 800 900 10002

    1.5

    1

    0.5

    0

    0.5

    1

    1.5

    2Active Noise Control of a Random Noise Signal

    Time Index

    Sign

    al V

    alue

    OriginalAttenuated

    See Also adaptfilt.dlms, adaptfilt.filtxlms

    2-15

  • adaptfilt.adjlms

    References Wan, Eric., Adjoint LMS: An Alternative to Filtered-X LMS andMultiple Error LMS, Proceedings of the International Conference onAcoustics, Speech, and Signal Processing (ICASSP), pp. 1841-1845,1997

    2-16

  • adaptfilt.ap

    Purpose FIR adaptive filter that uses direct matrix inversion

    Syntax ha = adaptfilt.ap(l,step,projectord,offset,coeffs,states,...errstates,epsstates)

    Description ha =adaptfilt.ap(l,step,projectord,offset,coeffs,states,...errstates,epsstates) constructs an affine projection FIR adaptivefilter ha using direct matrix inversion.

    Input Arguments

    Entries in the following table describe the input arguments foradaptfilt.ap.

    InputArgument Description

    l Adaptive filter length (the number of coefficients ortaps) and it must be a positive integer. l defaults to10.

    step Affine projection step size. This is a scalar thatshould be a value between zero and one. Setting stepequal to one provides the fastest convergence duringadaptation. step defaults to 1.

    projectord Projection order of the affine projection algorithm.projectord defines the size of the input signalcovariance matrix and defaults to two.

    offset Offset for the input signal covariance matrix. Youshould initialize the covariance matrix to a diagonalmatrix whose diagonal entries are equal to the offsetyou specify. offset should be positive. offsetdefaults to one.

    2-17

  • adaptfilt.ap

    InputArgument Description

    coeffs Vector containing the initial filter coefficients. It mustbe a length l vector, the number of filter coefficients.coeffs defaults to length l vector of zeros when youdo not provide the argument for input.

    states Vector of the adaptive filter states. states defaultsto a vector of zeros which has length equal to (l +projectord - 2).

    errstates Vector of the adaptive filter error states. errstatesdefaults to a zero vector with length equal to(projectord - 1).

    epsstates Vector of the epsilon values of the adaptive filter.epsstates defaults to a vector of zeros with(projectord - 1) elements.

    Properties Since your adaptfilt.ap filter is an object, it has properties that defineits behavior in operation. Note that many of the properties are alsoinput arguments for creating adaptfilt.ap objects. To show you theproperties that apply, this table lists and describes each property forthe affine projection filter object.

    Name Range Description

    Algorithm None Defines the adaptive filteralgorithm the object uses duringadaptation

    FilterLength Any positiveinteger

    Reports the length of the filter,the number of coefficients or taps

    2-18

  • adaptfilt.ap

    Name Range Description

    ProjectionOrder 1 to as largeas needed.

    Projection order of theaffine projection algorithm.ProjectionOrder defines thesize of the input signal covariancematrix and defaults to two.

    OffsetCov Matrix ofvalues

    Contains the offset covariancematrix

    Coefficients Vector ofelements

    Vector containing the initial filtercoefficients. It must be a lengthl vector, the number of filtercoefficients. coeffs defaults tolength l vector of zeros when youdo not provide the argument forinput.

    States Vector ofelements,data typedouble

    Vector of the adaptive filterstates. states defaults to a vectorof zeros which has length equalto (l + projectord - 2).

    ErrorStates Vector ofelements

    Vector of the adaptive filter errorstates. errstates defaults to azero vector with length equal to(projectord - 1).

    EpsilonStates Vector ofelements

    Vector of the epsilon values ofthe adaptive filter. epsstatesdefaults to a vector of zeros with(projectord - 1) elements.

    2-19

  • adaptfilt.ap

    Name Range Description

    StepSize Any scalarfrom zero toone, inclusive

    Specifies the step size takenbetween filter coefficient updates

    PersistentMemory false or true Determine whether the filterstates get restored to theirstarting values for eachfiltering operation. The startingvalues are the values in placewhen you create the filter.PersistentMemory returns tozero any state that the filterchanges during processing.States that the filter does notchange are not affected. Defaultsto true.

    Example Quadrature phase shift keying (QPSK) adaptive equalization using a32-coefficient FIR filter. Run the adaptation for 1000 iterations.

    D = 16; % Number of samples of delay

    b = exp(j*pi/4)*[-0.7 1]; % Numerator coefficients of channel

    a = [1 -0.7]; % Denominator coefficients of channel

    ntr= 1000; % Number of iterations

    s = sign(randn(1,ntr+D)) + j*sign(randn(1,ntr+D));% Baseband Signal

    n = 0.1*(randn(1,ntr+D) + j*randn(1,ntr+D)); % Noise signal

    r = filter(b,a,s)+n; % Received signal

    x = r(1+D:ntr+D); % Input signal (received signal)

    d = s(1:ntr); % Desired signal (delayed QPSK signal)

    mu = 0.1; % Step size

    po = 4; % Projection order

    offset = 0.05; % Offset for covariance matrix

    ha = adaptfilt.ap(32,mu,po,offset);

    [y,e] = filter(ha,x,d);

    subplot(2,2,1); plot(1:ntr,real([d;y;e])); title('In-Phase Components');

    2-20

  • adaptfilt.ap

    legend('Desired','Output','Error');

    xlabel('Time Index'); ylabel('Signal Value');

    subplot(2,2,2); plot(1:ntr,imag([d;y;e]));

    title('Quadrature Components');

    legend('Desired','Output','Error');

    xlabel('Time Index'); ylabel('Signal Value');

    subplot(2,2,3); plot(x(ntr-100:ntr),'.');

    axis([-3 3 -3 3]); title('Received Signal Scatter Plot');

    axis('square'); xlabel('Real[x]'); ylabel('Imag[x]'); grid on;

    subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]);

    title('Equalized Signal Scatter Plot');

    axis('square'); xlabel('Real[y]'); ylabel('Imag[y]'); grid on;

    The four plots shown reveal the QPSK process at work.

    0 200 400 600 800 10002

    1

    0

    1

    2InPhase Components

    Time Index

    Sign

    al V

    alue

    DesiredOutputError

    0 200 400 600 800 10003

    2

    1

    0

    1

    2

    3Quadrature Components

    Time Index

    Sign

    al V

    alue

    DesiredOutputError

    2 0 23

    2

    1

    0

    1

    2

    3Received Signal Scatter Plot

    Real[x]

    Imag

    [x]

    2 0 23

    2

    1

    0

    1

    2

    3Equalized Signal Scatter Plot

    Real[y]

    Imag

    [y]

    See Also msesim

    2-21

  • adaptfilt.ap

    References [1] Ozeki, K. and Umeda, T., An Adaptive Filtering Algorithm Usingan Orthogonal Projection to an Affine Subspace and Its Properties,Electronics and Communications in Japan, vol.67-A, no. 5, pp. 19-27,May 1984

    [2] Maruyama, Y., A Fast Method of Projection Algorithm, Proc. 1990IEICE Spring Conf., B-744

    2-22

  • adaptfilt.apru

    Purpose FIR adaptive filter that uses recursive matrix updating

    Syntax ha = adaptfilt.apru(l,step,projectord,offset,coeffs,states,...errstates,epsstates)

    Description ha = adaptfilt.apru(l,step,projectord,offset,coeffs,states,...errstates,epsstates) constructs an affine projection FIR adaptivefilter ha using recursive matrix updating.

    Input Arguments

    Entries in the following table describe the input arguments foradaptfilt.apru.

    InputArgument Description

    l Adaptive filter length (the number of coefficients ortaps). It must be a positive integer. l defaults to 10.

    step Affine projection step size. This is a scalar thatshould be a value between zero and one. Setting stepequal to one provides the fastest convergence duringadaptation. step defaults to 1.

    projectord Projection order of the affine projection algorithm.projectord defines the size of the input signalcovariance matrix and defaults to two.

    offset Offset for the input signal covariance matrix. Youshould initialize the covariance matrix to a diagonalmatrix whose diagonal entries are equal to the offsetyou specify. offset should be positive. offsetdefaults to one.

    coeffs Vector containing the initial filter coefficients. It mustbe a length l vector, the number of filter coefficients.coeffs defaults to length l vector of zeros when youdo not provide the argument for input.

    2-23

  • adaptfilt.apru

    InputArgument Description

    states Vector of the adaptive filter states. states defaultsto a vector of zeros which has length equal to (l +projectord - 2).

    errstates Vector of the adaptive filter error states. errstatesdefaults to a zero vector with length equal to(projectord - 1).

    epsstates Vector of the epsilon values of the adaptive filter.epsstates defaults to a vector of zeros with(projectord - 1) elements.

    Properties Since your adaptfilt.apru filter is an object, it has properties thatdefine its behavior in operation. Note that many of the properties arealso input arguments for creating adaptfilt.apru objects. To show youthe properties that apply, this table lists and describes each propertyfor the affine projection filter object.

    Name Range Description

    Algorithm None Defines the adaptive filteralgorithm the object usesduring adaptation

    FilterLength Any positiveinteger

    Reports the length of the filter,the number of coefficients ortaps

    ProjectionOrder 1 to as largeas needed.

    Projection order of theaffine projection algorithm.ProjectionOrder definesthe size of the input signalcovariance matrix and defaultsto two.

    2-24

  • adaptfilt.apru

    Name Range Description

    OffsetCov Matrix ofvalues

    Contains the offset covariancematrix

    Coefficients Vector ofelements

    Vector containing the initialfilter coefficients. It must bea length l vector, the numberof filter coefficients. coeffsdefaults to length l vector ofzeros when you do not providethe argument for input.

    States Vector ofelements,data typedouble

    Vector of the adaptive filterstates. states defaults toa vector of zeros which haslength equal to (l + projectord- 2).

    ErrorStates Vector ofelements

    Vector of the adaptive filtererror states. errstatesdefaults to a zero vector withlength equal to (projectord -1).

    EpsilonStates Vector ofelements

    Vector of the epsilon values ofthe adaptive filter. epsstatesdefaults to a vector of zeroswith (projectord - 1) elements.

    2-25

  • adaptfilt.apru

    Name Range Description

    StepSize Any scalarfrom zero toone, inclusive

    Specifies the step size takenbetween filter coefficientupdates

    PersistentMemory false or true Determine whether the filterstates get restored to theirstarting values for eachfiltering operation. Thestarting values are the valuesin place when you create thefilter. PersistentMemoryreturns to zero any statethat the filter changes duringprocessing. States that thefilter does not change are notaffected. Defaults to true.

    Example Demonstrate quadrature phase shift keying (QPSK) adaptiveequalization using a 32-coefficient FIR filter. This example runs theadaptation process for 1000 iterations.

    D = 16; % Number of samples of delay

    b = exp(j*pi/4)*[-0.7 1]; % Numerator coefficients of channel

    a = [1 -0.7]; % Denominator coefficients of channel

    ntr= 1000; % Number of iterations

    s = sign(randn(1,ntr+D)) + j*sign(randn(1,ntr+D)); % Baseband

    n = 0.1*(randn(1,ntr+D) + j*randn(1,ntr+D)); % Noise signal

    r = filter(b,a,s)+n; % Received signal

    x = r(1+D:ntr+D); % Input signal (received signal)

    d = s(1:ntr); % Desired signal (delayed QPSK signal)

    mu = 0.1; % Step size

    po = 4; % Projection order

    del = 0.05; % Offset

    ha = adaptfilt.apru(32,mu,po,offset); [y,e] = filter(ha,x,d);

    subplot(2,2,1); plot(1:ntr,real([d;y;e])); title('In-Phase Components');

    2-26

  • adaptfilt.apru

    legend('Desired','Output','Error');

    xlabel('Time Index'); ylabel('Signal Value');

    subplot(2,2,2); plot(1:ntr,imag([d;y;e])); title('Quadrature Components');

    legend('Desired','Output','Error');

    xlabel('Time Index'); ylabel('Signal Value');

    subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]);

    title('Received Signal Scatter Plot');

    axis('square'); xlabel('Real[x]'); ylabel('Imag[x]'); grid on;

    subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]);

    title('Equalized Signal Scatter Plot');

    axis('square'); xlabel('Real[y]'); ylabel('Imag[y]'); grid on;

    In the following component and scatter plots, you see the results ofQPSK equalization.

    0 200 400 600 800 10004

    3

    2

    1

    0

    1

    2

    3InPhase Components

    Time Index

    Sign

    al V

    alue

    DesiredOutputError

    0 200 400 600 800 10003

    2

    1

    0

    1

    2

    3Quadrature Components

    Time Index

    Sign

    al V

    alue

    DesiredOutputError

    2 0 23

    2

    1

    0

    1

    2

    3Received Signal Scatter Plot

    Real[x]

    Imag

    [x]

    2 0 23

    2

    1

    0

    1

    2

    3Equalized Signal Scatter Plot

    Real[y]

    Imag

    [y]

    2-27

  • adaptfilt.apru

    See Also adaptfilt, adaptfilt.ap, adaptfilt.bap

    References [1] Ozeki. K., T. Omeda, An Adaptive Filtering Algorithm Usingan Orthogonal Projection to an Affine Subspace and Its Properties,Electronics and Communications in Japan, vol. 67-A, no. 5, pp. 19-27,May 1984

    [2] Maruyama, Y, A Fast Method of Projection Algorithm, Proceedings1990 IEICE Spring Conference, B-744

    2-28

  • adaptfilt.bap

    Purpose FIR adaptive filter that uses block affine projection

    Syntax ha = adaptfilt.bap(l,step,projectord,offset,coeffs,states)

    Description ha = adaptfilt.bap(l,step,projectord,offset,coeffs,states)constructs a block affine projection FIR adaptive filter ha.

    Input Arguments

    Entries in the following table describe the input arguments foradaptfilt.bap.

    InputArgument Description

    l Adaptive filter length (the number of coefficientsor taps) and it must be a positive integer. ldefaults to 10.

    step Affine projection step size. This is a scalar thatshould be a value between zero and one. Settingstep equal to one provides the fastest convergenceduring adaptation. step defaults to 1.

    projectord Projection order of the affine projection algorithm.projectord defines the size of the input signalcovariance matrix and defaults to two.

    offset Offset for the input signal covariance matrix.You should initialize the covariance matrix to adiagonal matrix whose diagonal entries are equalto the offset you specify. offset should be positive.offset defaults to one.

    2-29

  • adaptfilt.bap

    InputArgument Description

    coeffs Vector containing the initial filter coefficients. Itmust be a length l vector, the number of filtercoefficients. coeffs defaults to length l vector ofzeros when you do not provide the argument forinput.

    states Vector of the adaptive filter states. states defaultsto a vector of zeros which has length equal to (l+ projectord - 2).

    Properties Since your adaptfilt.bap filter is an object, it has properties thatdefine its behavior in operation. Note that many of the properties arealso input arguments for creating adaptfilt.bap objects. To show youthe properties that apply, this table lists and describes each propertyfor the affine projection filter object.

    Name Range Description

    Algorithm None Defines the adaptive filteralgorithm the object usesduring adaptation

    FilterLength Any positiveinteger

    Reports the length ofthe filter, the number ofcoefficients or taps

    ProjectionOrder 1 to as large asneeded.

    Projection order of theaffine projection algorithm.ProjectionOrder definesthe size of the input signalcovariance matrix anddefaults to two.

    OffsetCov Matrix of values Contains the offsetcovariance matrix

    2-30

  • adaptfilt.bap

    Name Range Description

    Coefficients Vector ofelements

    Vector containing the initialfilter coefficients. It mustbe a length l vector, thenumber of filter coefficients.coeffs defaults to length lvector of zeros when you donot provide the argument forinput.

    States Vector ofelements, datatype double

    Vector of the adaptive filterstates. states defaults toa vector of zeros whichhas length equal to (l +projectord - 2).

    StepSize Any scalar fromzero to one,inclusive

    Specifies the step size takenbetween filter coefficientupdates

    PersistentMemory false or true Determine whether the filterstates get restored to theirstarting values for eachfiltering operation. Thestarting values are the valuesin place when you create thefilter. PersistentMemoryreturns to zero any statethat the filter changes duringprocessing. States that thefilter does not change are notaffected. Defaults to true.

    Example Show an example of quadrature phase shift keying (QPSK) adaptiveequalization using a 32-coefficient FIR filter.

    D = 16; % delay

    2-31

  • adaptfilt.bap

    b = exp(j*pi/4)*[-0.7 1]; % Numerator coefficients

    a = [1 -0.7]; % Denominator coefficients

    ntr= 1000; % Number of iterations

    s = sign(randn(1,ntr+D))+j*sign(randn(1,ntr+D));% Baseband signal

    n = 0.1*(randn(1,ntr+D) + j*randn(1,ntr+D)); % Noise signal

    r = filter(b,a,s)+n; % Received signal

    x = r(1+D:ntr+D); % Input signal (received signal)

    d = s(1:ntr); % Desired signal (delayed QPSK signal)

    mu = 0.5; % Step size

    po = 4; % Projection order

    offset = 1.0; % Offset for covariance matrix

    ha = adaptfilt.bap(32,mu,po,offset);

    [y,e] = filter(ha,x,d); subplot(2,2,1);

    plot(1:ntr,real([d;y;e]));

    title('In-Phase Components'); legend('Desired','Output','Error');

    xlabel('Time Index'); ylabel('Signal Value');

    subplot(2,2,2); plot(1:ntr,imag([d;y;e]));

    title('Quadrature Components');

    legend('Desired','Output','Error');

    xlabel('Time Index'); ylabel('Signal Value');

    subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]);

    title('Received Signal Scatter Plot'); axis('square');

    xlabel('Real[x]'); ylabel('Imag[x]'); grid on;

    subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]);

    title('Equalized Signal Scatter Plot'); axis('square');

    xlabel('Real[y]'); ylabel('Imag[y]'); grid on;

    2-32

  • adaptfilt.bap

    0 200 400 600 800 10004

    2

    0

    2

    4InPhase Components

    Time Index

    Sign

    al V

    alue

    DesiredOutputError

    0 200 400 600 800 10004

    3

    2

    1

    0

    1

    2

    3Quadrature Components

    Time Index

    Sign

    al V

    alue

    DesiredOutputError

    2 0 23

    2

    1

    0

    1

    2

    3Received Signal Scatter Plot

    Real[x]

    Imag

    [x]

    2 0 23

    2

    1

    0

    1

    2

    3Equalized Signal Scatter Plot

    Real[y]

    Imag

    [y]

    Using the block affine projection object in QPSK results in the plotsshown here.

    See Also adaptfilt, adaptfilt.ap, adaptfilt.apru

    References [1] Ozeki, K. and T. Omeda, An Adaptive Filtering Algorithm Usingan Orthogonal Projection to an Affine Subspace and Its Properties,Electronics and Communications in Japan, vol. 67-A, no. 5, pp. 19-27,May 1984

    [2] Montazeri, M. and Duhamel, P, A Set of Algorithms Linking NLMSand Block RLS Algorithms, IEEE Transactions Signal Processing, vol.43, no. 2, pp, 444-453, February 1995

    2-33

  • adaptfilt.blms

    Purpose FIR adaptive filter that uses BLMS

    Syntax ha = adaptfilt.blms(l,step,leakage,blocklen,coeffs,states)

    Description ha = adaptfilt.blms(l,step,leakage,blocklen,coeffs,states)constructs an FIR block LMS adaptive filter ha, where l is the adaptivefilter length (the number of coefficients or taps) and must be a positiveinteger. l defaults to 10.step is the block LMS step size. You must set step to a nonnegativescalar. You can use function maxstep to determine a reasonable rangeof step size values for the signals being processed. When unspecified,step defaults to 0.leakage is the block LMS leakage factor. It must be a scalar between 0and 1. If you set leakage to be less than one, you implement the leakyblock LMS algorithm. leakage defaults to 1 specifying no leakage inthe adapting algorithm.blocklen is the block length used. It must be a positive integer andthe signal vectors d and x should be divisible by blocklen. Largerblock lengths result in faster per-sample execution times but withpoor adaptation characteristics. When you choose blocklen such thatblocklen + length(coeffs) is a power of 2, use adaptfilt.blmsfft.blocklen defaults to l.coeffs is a vector of initial filter coefficients. it must be a length lvector. coeffs defaults to length l vector of zeros.states contains a vector of your initial filter states. It must be a lengthl vector and defaults to a length l vector of zeros when you do notinclude it in your calling function.

    Properties In the syntax for creating the adaptfilt object, the input options areproperties of the object created. This table lists the properties for theadjoint LMS object, their default values, and a brief description of theproperty.

    2-34

  • adaptfilt.blms

    PropertyDefaultValue Description

    Algorithm None Defines the adaptive filter algorithmthe object uses during adaptation

    FilterLength Anypositiveinteger

    Reports the length of the filter, thenumber of coefficients or taps

    Coefficients Vector ofelements

    Vector containing the initial filtercoefficients. It must be a lengthl vector where l is the number offilter coefficients. coeffs defaults tolength l vector of zeros when you donot provide the argument for input.

    States Vector ofelements

    Vector of the adaptive filter states.states defaults to a vector of zeroswhich has length equal to l

    Leakage Specifies the leakage parameter.Allows you to implement a leakyalgorithm. Including a leakagefactor can improve the results of thealgorithm by forcing the algorithmto continue to adapt even after itreaches a minimum value. Rangesbetween 0 and 1.

    BlockLength Vector oflength l

    Size of the blocks of data processedin each iteration

    2-35

  • adaptfilt.blms

    PropertyDefaultValue Description

    StepSize 0.1 Sets the block LMS algorithm stepsize used for each iteration of theadapting algorithm. Determinesboth how quickly and how closely theadaptive filter converges to the filtersolution. Use maxstep to determinethe maximum usable step size.

    PersistentMemory false ortrue

    Determine whether the filter statesget restored to their starting valuesfor each filtering operation. Thestarting values are the values inplace when you create the filter.PersistentMemory returns to zeroany state that the filter changesduring processing. States thatthe filter does not change are notaffected. Defaults to false.

    Example Use an adaptive filter to identify an unknown 32nd-order FIR filter.In this example 500 input samples result in 500 iterations of theadaptation process. You see in the plot that follows the example codethat the adaptive filter has determined the coefficients of the unknownsystem under test.

    x = randn(1,500); % Input to the filterb = fir1(31,0.5); % FIR system to be identifiedno = 0.1*randn(1,500); % Observation noise signald = filter(b,1,x)+no; % Desired signalmu = 0.008; % Block LMS step sizen = 5; % Block lengthha = adaptfilt.blms(32,mu,1,n);[y,e] = filter(ha,x,d);subplot(2,1,1); plot(1:500,[d;y;e]);

    2-36

  • adaptfilt.blms

    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;

    Based on looking at the figures here, the adaptive filter correctlyidentified the unknown system after 500 iterations, or fewer. In thelower plot, you see the comparison between the actual filter coefficientsand those determined by the adaptation process.

    0 50 100 150 200 250 300 350 400 450 5003

    2

    1

    0

    1

    2

    3System Identification of an FIR filter

    Time Index

    Sign

    al V

    alue

    DesiredOutputError

    0 5 10 15 20 25 30 350.1

    0

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    Coefficient #

    Coef

    ficie

    nt V

    alue

    ActualEstimated

    See Also adaptfilt.blmsfft, adaptfilt.fdaf, adaptfilt.lms

    2-37

  • adaptfilt.blms

    References Shynk, J.J.,Frequency-Domain and Multirate Adaptive Filtering,IEEE Signal Processing Magazine, vol. 9, no. 1, pp. 14-37, Jan. 1992.

    2-38

  • adaptfilt.blmsfft

    Purpose FIR adaptive filter that uses FFT-based BLMS

    Syntax ha = adaptfilt.blmsfft(l,step,leakage,blocklen,coeffs,states)

    Description ha = adaptfilt.blmsfft(l,step,leakage,blocklen,coeffs,states) constructs an FIR block LMS adaptive filter object ha wherel is the adaptive filter length (the number of coefficients or taps) andmust be a positive integer. l defaults to 10. step is the block LMSstep size. It must be a nonnegative scalar. The function maxstep maybe helpful to determine a reasonable range of step size values for thesignals you are processing. step defaults to 0.leakage is the block LMS leakage factor. It must also be ascalar between 0 and 1. When leakage is less than one, theadaptfilt.blmsfft implements a leaky block LMS algorithm. leakagedefaults to 1 (no leakage). blocklen is the block length used. It must bea positive integer such that

    blocklen + length(coeffs)

    is a power of two; otherwise, an adaptfilt.blms algorithm is usedfor adapting. Larger block lengths result in faster execution times,with poor adaptation characteristics as the cost of the speed gained.blocklen defaults to l. Enter your initial filter coefficients in coeffs, avector of length l. When omitted, coeffs defaults to a length l vector ofall zeros. states contains a vector of initial filter states; it must be alength l vector. states defaults to a length l vector of all zeros whenyou omit the states argument in the calling syntax.

    Properties In the syntax for creating the adaptfilt object, the input optionsare properties of the object you create. This table lists the propertiesfor the block LMS object, their default values, and a brief descriptionof the property.

    2-39

  • adaptfilt.blmsfft

    PropertyDefaultValue Description

    Algorithm None Defines the adaptive filteralgorithm the object uses duringadaptation

    FilterLength Anypositiveinteger

    Reports the length of the filter, thenumber of coefficients or taps

    Coefficients Vector ofelements

    Vector containing the initial filtercoefficients. It must be a lengthl vector where l is the number offilter coefficients. coefficientsdefaults to length l vector ofzeros when you do not provide theargument for input.

    States Vector ofelementsof lengthl

    Vector of the adaptive filter states.states defaults to a vector of zeroswhich has length equal to l

    Leakage 1 Specifies the leakage parameter.Allows you to implement a leakyalgorithm. Including a leakagefactor can improve the results of thealgorithm by forcing the algorithmto continue to adapt even after itreaches a minimum value. Rangesbetween 0 and 1.

    BlockLength Vector oflength l

    Size of the blocks of data processedin each iteration

    2-40

  • adaptfilt.blmsfft

    PropertyDefaultValue Description

    StepSize 0.1 Sets the block LMS algorithm stepsize used for each iteration of theadapting algorithm. Determinesboth how quickly and how closelythe adaptive filter converges tothe filter solution. Use maxstep todetermine the maximum usablestep size.

    PersistentMemory false ortrue

    Determine whether the filter statesget restored to their starting valuesfor each filtering operation. Thestarting values are the values inplace when you create the filter.PersistentMemory returns to zeroany state that the filter changesduring processing. States thatthe filter does not change are notaffected. Defaults to false.

    Example Identify an unknown FIR filter with 32 coefficients using 512 iterationsof the adapting algorithm.

    x = randn(1,512); % Input to the filterb = fir1(31,0.5); % FIR system to be identifiedno = 0.1*randn(1,512); % Observation noise signald = filter(b,1,x)+no; % Desired signalmu = 0.008; % Step sizen = 16; % Block lengthha = adaptfilt.blmsfft(32,mu,1,n);[y,e] = filter(ha,x,d);subplot(2,1,1); plot(1:500,[d(1:500);y(1:500);e(1:500)]);title('System Identification of an FIR Filter');legend('Desired','Output','Error'); xlabel('Time Index');

    2-41

  • adaptfilt.blmsfft

    ylabel('Signal Value');subplot(2,1,2); stem([b.',ha.coefficients.']);legend('actual','estimated'); grid on;xlabel('Coefficient #'); ylabel('Coefficient Value');

    0 50 100 150 200 250 300 350 400 450 5002

    1

    0

    1

    2

    3System Identification of an FIR Filter

    Time Index

    Sign

    al V

    alue

    DesiredOutputError

    0 5 10 15 20 25 30 350.1

    0

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    Coefficient #

    Coef

    ficie

    nt V

    alue

    actualestimated

    As a result of running the adaptation process, filter object ha nowmatches the unknown system FIR filter b, based on comparing the filtercoefficients derived during adaptation.

    See Also adaptfilt.blms, adaptfilt.fdaf, adaptfilt.lms, filter

    References Shynk, J.J., Frequency-Domain and Multirate Adaptive Filtering,IEEE Signal Processing Magazine, vol. 9, no. 1, pp. 14-37, Jan. 1992.

    2-42

  • adaptfilt.dlms

    Purpose FIR adaptive filter that uses delayed LMS

    Syntax ha = adaptfilt.dlms(l,step,leakage,delay,errstates,coeffs,...states)

    Description ha = adaptfilt.dlms(l,step,leakage,delay,errstates,coeffs,...states) constructs an FIR delayed LMS adaptive filter ha.

    Input Arguments

    Entries in the following table describe the input arguments foradaptfilt.dlms.

    InputArgument Description

    l Adaptive filter length (the number of coefficients ortaps) and it must be a positive integer. l defaultsto 10.

    step LMS step size. It must be a nonnegative scalar. Youcan use maxstep to determine a reasonable rangeof step size values for the signals being processed.step defaults to 0.

    leakage Your LMS leakage factor. It must be a scalarbetween 0 and 1. When leakage is less than one,adaptfilt.lms implements a leaky LMS algorithm.When you omit the leakage property in the callingsyntax, it defaults to 1 providing no leakage in theadapting algorithm.

    delay Update delay given in time samples. This scalarshould be a positive integer negative delays donot work. delay defaults to 1.

    errstates Vector of the error states of your adaptive filter. Itmust have a length equal to the update delay (delay)in samples. errstates defaults to an appropriatelength vector of zeros.

    2-43

  • adaptfilt.dlms

    InputArgument Description

    coeffs Vector of initial filter coefficients. it must be alength l vector. coeffs defaults to length l vectorwith elements equal to zero.

    states Vector of initial filter states for the adaptive filter.It must be a length l-1 vector. states defaults to alength l-1 vector of zeros.

    Properties In the syntax for creating the adaptfilt object, the input optionsare properties of the object you create. This table lists the propertiesfor the block LMS object, their default values, and a brief descriptionof the property.

    PropertyDefaultValue Description

    Algorithm None Defines the adaptive filteralgorithm the object uses duringadaptation

    Coefficients Vector ofelements

    Vector containing the initial filtercoefficients. It must be a lengthl vector where l is the numberof filter coefficients. coeffsdefaults to length l vector ofzeros when you do not providethe argument for input. LMSFIR filter coefficients. Shouldbe initialized with the initialcoefficients for the FIR filterprior to adapting. You need lentries in coeffs.

    Delay 1 Specifies the update delay for theadaptive algorithm.

    2-44

  • adaptfilt.dlms

    PropertyDefaultValue Description

    ErrorStates Vector ofzeros withthe numberof elementsequal todelay

    A vector comprising the errorstates for the adaptive filter.

    FilterLength Any positiveinteger

    Reports the length of the filter,the number of coefficients ortaps.

    Leakage 1 Specifies the leakage parameter.Allows you to implement a leakyalgorithm. Including a leakagefactor can improve the resultsof the algorithm by forcing thealgorithm to continue to adapteven after it reaches a minimumvalue. Ranges between 0 and 1.

    PersistentMemory false ortrue

    Determine whether the filterstates get restored to theirstarting values for each filteringoperation. The starting valuesare the values in place whenyou create the filter if youhave not changed the filtersince you constructed it.PersistentMemory returns tozero any state that the filterchanges during processing.States that the filter does notchange are not affected. Defaultsto false.

    2-45

  • adaptfilt.dlms

    PropertyDefaultValue Description

    StepSize 0.1 Sets the LMS algorithm step sizeused for each iteration of theadapting algorithm. Determinesboth how quickly and how closelythe adaptive filter converges tothe filter solution.

    States Vector ofelements,data typedouble

    Vector of the adaptive filterstates. states defaults to avector of zeros which has lengthequal to (l + projectord - 2).

    Example System identification of a 32-coefficient FIR filter. Refer to the figurethat follows to see the results of the adapting filter process.

    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.delay = 1; % Update delayha = adaptfilt.dlms(32,mu,1,delay);[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'); grid on;xlabel('Coefficient #'); ylabel('Coefficient Value');

    Using a delayed LMS adaptive filter in the process to identify anunknown filter appears to work as planned, as shown in this figure.

    2-46

  • adaptfilt.dlms

    0 50 100 150 200 250 300 350 400 450 5003

    2

    1

    0

    1

    2System Identification of an FIR Filter

    Time Index

    Sign

    al V

    alue

    0 5 10 15 20 25 30 350.1

    0

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    Coefficient #

    Coef

    ficie

    nt V

    alue

    DesiredOutputError

    ActualEstimated

    See Also adaptfilt.adjlms, adaptfilt.filtxlms, adaptfilt.lms

    References Shynk, J.J.,Frequency-Domain and Multirate Adaptive Filtering,IEEE Signal Processing Magazine, vol. 9, no. 1, pp. 14-37, Jan. 1992.

    2-47

  • adaptfilt.fdaf

    Purpose FIR adaptive filter that uses frequency-domain with bin step sizenormalization

    Syntax ha = adaptfilt.fdaf(l,step,leakage,delta,lambda,blocklen,offset,...coeffs,states)

    Description ha = adaptfilt.fdaf(l,step,leakage,delta,lambda,blocklen,offset,...coeffs,states) constructs a frequency-domain FIRadaptive filter ha with bin step size normalization. If you omit all theinput arguments you create a default object with l = 10 and step = 1.

    Input Arguments

    Entries in the following table describe the input arguments foradaptfilt.fdaf.

    InputArgument Description

    l Adaptive filter length (the number of coefficients ortaps). l must be a positive integer; it defaults to 10when you omit the argument.

    step Step size of the adaptive filter. This is a scalar andshould lie in the range (0,1]. step defaults to 1.

    leakage Leakage parameter of the adaptive filter. If thisparameter is set to a value between zero and one,you implement a leaky FDAF algorithm. leakagedefaults to 1 no leakage provided in the algorithm.

    delta Initial common value of all of the FFT input signalpowers. Its initial value should be positive. deltadefaults to 1.

    lambda Specifies the averaging factor used to compute theexponentially-windowed FFT input signal powers forthe coefficient updates. lambda should lie in the range(0,1]. lambda defaults to 0.9.

    2-48

  • adaptfilt.fdaf

    InputArgument Description

    blocklen Block length for the coefficient updates. This must bea positive integer. For faster execution, (blocklen +l) should be a power of two. blocklen defaults to l.

    offset Offset for the normalization terms in the coefficientupdates. Use this to avoid divide by zeros or by verysmall numbers when any of the FFT input signalpowers become very small. offset defaults to zero.

    coeffs Initial time-domain coefficients of the adaptive filter.coeff should be a length l vector. The adaptivefilter object uses these coefficients to compute theinitial frequency-domain filter coefficients via an FFTcomputed after zero-padding the time-domain vectorby the blocklen.

    states The adaptive filter states. states defaults to a zerovector that has length equal to l.

    Properties Since your adaptfilt.fdaf filter is an object, it has properties thatdefine its behavior in operation. Note that many of the propertiesare also input arguments for creating adaptfilt.fdaf objects. Toshow you the properties that apply, this table lists and describes eachproperty for the adaptfilt.fdaf filter object.

    2-49

  • adaptfilt.fdaf

    Name Range Description

    Algorithm None Defines the adaptive filteralgorithm the object uses duringadaptation.

    AvgFactor (0, 1] Specifies the averagingfactor used to compute theexponentially-windowed FFTinput signal powers for thecoefficient updates. Same as theinput argument lambda.

    BlockLength Any integer Block length for the coefficientupdates. This must be a positiveinteger. For faster execution,(blocklen + l) should be a powerof two. blocklen defaults to l.

    FFTCoefficients Stores the discrete Fouriertransform of the filter coefficientsin coeffs.

    FFTStates States for the FFT operation.FilterLength Any

    positiveinteger

    Reports the length of the filter,the number of coefficients or taps.

    Leakage Leakage parameter of theadaptive filter. if this parameteris set to a value between zero andone, you implement a leaky FDAFalgorithm. leakage defaults to1 no leakage provided in thealgorithm.

    2-50

  • adaptfilt.fdaf

    Name Range Description

    Offset Anypositive realvalue

    Offset for the normalizationterms in the coefficient updates.Use this to avoid dividing byzero or by very small numberswhen any of the FFT inputsignal powers become very small.offset defaults to zero.

    PersistentMemory false ortrue

    Determine whether the filterstates get restored to theirstarting values for eachfiltering operation. The startingvalues are the values in placewhen you create the filter.PersistentMemory returns tozero any state that the filterchanges during processing.States that the filter does notchange are not affected. Defaultsto false.

    Power A vector of 2*l elements, eachinitialized with the value deltafrom the input arguments. As youfilter data, Power gets updated bythe filter process.

    StepSize Any scalarfrom zeroto one,inclusive

    Specifies the step size takenbetween filter coefficient updates

    Examples Quadrature Phase Shift Keying (QPSK) adaptive equalization using1024 iterations of a 32-coefficient FIR filter. After this example code, afigure demonstrates the equalization results.

    2-51

  • adaptfilt.fdaf

    D = 16; % Number of samples of delay

    b = exp(j*pi/4)*[-0.7 1]; % Numerator coefficients of channel

    a = [1 -0.7]; % Denominator coefficients of channel

    ntr= 1024; % Number of iterations

    s = sign(randn(1,ntr+D))+j*sign(randn(1,ntr+D)); %QPSK signal

    n = 0.1*(randn(1,ntr+D) + j*randn(1,ntr+D)); % Noise signal

    r = filter(b,a,s)+n; % Received signal

    x = r(1+D:ntr+D); % Input signal (received signal)

    d = s(1:ntr); % Desired signal (delayed QPSK signal)

    del = 1; % Initial FFT input powers

    mu = 0.1; % Step size

    lam = 0.9; % Averaging factor

    ha = adaptfilt.fdaf(32,mu,1,del,lam);

    [y,e] = filter(ha,x,d);

    subplot(2,2,1); plot(1:ntr,real([d;y;e])); title('In-Phase Components');

    legend('Desired','Output','Error');

    xlabel('Time Index'); ylabel('signal value');

    subplot(2,2,2); plot(1:ntr,imag([d;y;e])); title('Quadrature Components');

    legend('Desired','Output','Error');

    xlabel('Time Index'); ylabel('signal value');

    subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]);

    title('Received Signal Scatter Plot'); axis('square');

    xlabel('Real[x]'); ylabel('Imag[x]'); grid on;

    subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]);

    title('Equalized Signal Scatter Plot'); axis('square');

    xlabel('Real[y]'); ylabel('Imag[y]'); grid on;

    2-52

  • adaptfilt.fdaf

    0 500 1000 15002

    1

    0

    1

    2

    3InPhase Components

    Time Index

    sign

    al v

    alue

    DesiredOutputError

    0 500 1000 15002

    1.5

    1

    0.5

    0

    0.5

    1

    1.5Quadrature Components

    Time Index

    sign

    al v

    alue

    DesiredOutputError

    2 0 23

    2

    1

    0

    1

    2

    3Received Signal Scatter Plot

    Real[x]

    Imag

    [x]

    2 0 23

    2

    1

    0

    1

    2

    3Equalized Signal Scatter Plot

    Real[y]Im

    ag[y]

    See Also adaptfilt.ufdaf, adaptfilt.pbfdaf, adaptfilt.blms,adaptfilt.blmsfft

    References Shynk, J.J.,Frequency-Domain and Multirate Adaptive Filtering,IEEE Signal Processing Magazine, vol. 9, no. 1, pp. 14-37, Jan. 1992

    2-53

  • adaptfilt.filtxlms

    Purpose FIR adaptive filter that uses filtered-x LMS

    Syntax ha = adaptfilt.filtxlms(l,step,leakage,pathcoeffs,pathest,...errstates,pstates,coeffs,states)

    Description ha = adaptfilt.filtxlms(l,step,leakage,pathcoeffs,pathest,...errstates,pstates,coeffs,states) constructs anfiltered-x LMS adaptive filter ha.

    Input Arguments

    Entries in the following table describe the input arguments foradaptfilt.filtxlms.

    InputArgument Description

    l Adaptive filter length (the number of coefficients ortaps) and it must be a positive integer. l defaultsto 10.

    step Filtered LMS step size. it must be a nonnegativescalar. step defaults to 0.1.

    leakage is the filtered-x LMS leakage factor. it must be ascalar between 0 and 1. If it is less than one, a leakyversion of adaptfilt.filtxlms is implemented.leakage defaults to 1 (no leakage).

    pathcoeffs is the secondary path filter model. this vector shouldcontain the coefficient values of the secondary pathfrom the output actuator to the error sensor.

    pathest is the estimate of the secondary path filter model.pathest defaults to the values in pathcoeffs.

    fstates is a vector of filtered input states of the adaptivefilter. fstates defaults to a zero vector of lengthequal to (l - 1).

    2-54

  • adaptfilt.filtxlms

    InputArgument Description

    pstates are the secondary path FIR filter states. it must bea vector of length equal to the (length(pathcoeffs)- 1). pstates defaults to a vector of zeros ofappropriate length.

    coeffs is a vector of initial filter coefficients. it must be alength l vector. coeffs defaults to length l vectorof zeros.

    states Vector of initial filter states. states defaultsto a zero vector of length equal to the larger of(length(pathcoeffs) - 1) and (length(pathest) - 1).

    Properties In the syntax for creating the adaptfilt object, the input options areproperties of the object created. This table lists the properties for theadjoint LMS object, their default values, and a brief description of theproperty.

    PropertyDefaultValue Description

    Algorithm None Defines the adaptive filteralgorithm the object usesduring adaptation

    Coefficients Vector ofelements

    Vector containing theinitial filter coefficients. Itmust be a length l vectorwhere l is the number offilter coefficients. coeffsdefaults to length l vectorof zeros when you do notprovide the argument forinput.

    2-55

  • adaptfilt.filtxlms

    PropertyDefaultValue Description

    FilteredInputStates l-1 Vector of filtered inputstates with length equal tol - 1.

    FilterLength Any positiveinteger

    Reports the length ofthe filter, the number ofcoefficients or taps

    States Vector ofelements

    Vector of the adaptivefilter states. statesdefaults to a vector of zeroswhich has length equalto (l + projectord - 2)

    SecondaryPathCoeffs No default A vector that contains thecoefficient values of yoursecondary path from theoutput actuator to theerror sensor

    SecondaryPathEstimate pathcoeffsvalues

    An estimate of thesecondary path filtermodel

    SecondaryPathStates Vector ofsize (length(pathcoeffs)-1) with allelementsequal to zero.

    The states of the secondarypath FIR filter theunknown system

    StepSize 0.1 Sets the filtered-xalgorithm step sizeused for each iterationof the adapting algorithm.Determines both howquickly and how closely the

    2-56

  • adaptfilt.filtxlms

    PropertyDefaultValue Description

    adaptive filter convergesto the filter solution.

    Example Demonstrate active noise control of a random noise signal over 1000iterations.As the figure that follows this code demonstrates, the filtered-x LMSfilter successfully controls random noise in this context.

    x = randn(1,1000); % Noise source

    g = fir1(47,0.4); % FIR primary path system model

    n = 0.1*randn(1,1000); % Observation noise signal

    d = filter(g,1,x)+n; % Signal to be cancelled

    b = fir1(31,0.5); % FIR secondary path system model

    mu = 0.008; % Filtered-X LMS step size

    ha = adaptfilt.filtxlms(32,mu,1,b);

    [y,e] = filter(ha,x,d); 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;

    2-57

  • adaptfilt.filtxlms

    0 100 200 300 400 500 600 700 800 900 10003

    2

    1

    0

    1

    2

    3Active Noise Control of a Random Noise Signal

    Time Index

    Sign

    al V

    alue

    OriginalAttenuated

    See also adaptfilt.dlms, adaptfilt.lms

    References Kuo, S.M., and Morgan, D.R. Active Noise Control Systems: Algorithmsand DSP Implementations, New York, N.Y: John Wiley & Sons, 1996.Widrow, B., and Stearns, S.D. Adaptive Signal Processing, UpperSaddle River, N.J: Prentice Hall, 1985.

    2-58

  • adaptfilt.ftf

    Purpose Fast transversal LMS adaptive filter

    Syntax ha = adaptfilt.ftf(l,lambda,delta,gamma,gstates,coeffs,states)

    Description ha = adaptfilt.ftf(l,lambda,delta,gamma,gstates,coeffs,states) constructs a fast transversal least squares adaptive filterobject ha.

    Input Arguments

    Entries in the following table describe the input arguments foradaptfilt.ftf.

    InputArgument Description

    l Adaptive filter length (the number of coefficients ortaps) and it must be a positive integer. l defaultsto 10.

    lambda RLS forgetting factor. This is a scalar that shouldlie in the range (1-0.5/l, 1]. lambda defaults to 1.

    delta Soft-constrained initialization factor. This scalarshould be positive and sufficiently large to preventan excessive number of Kalman gain rescues. deltadefaults to one.

    gamma Conversion factor. gamma defaults to one specifyingsoft-constrained initialization.

    gstates States of the Kalman gain updates. gstatesdefaults to a zero vector of length l.

    coeffs Length l vector of initial filter coefficients. coeffsdefaults to a length l vector of zeros.

    states Vector of initial filter States. states defaults to azero vector of length (l-1).

    2-59

  • adaptfilt.ftf

    Properties Since your adaptfilt.ftf filter is an object, it has properties thatdefine its operating behavior. Note that many of the properties are alsoinput arguments for creating adaptfilt.ftf objects. To show you theproperties that apply, this table lists and describes each property forthe fast transversal least squares filter object.

    Name Range Description

    Algorithm None Defines the adaptive filteralgorithm the object uses duringadaptation

    BkwdPrediction Returns the predicted samplesgenerated during adaptation.Refer to [2] in the bibliographyfor details about linearprediction.

    Coefficients Vector ofelements

    Vector containing the initialfilter coefficients. It must be alength l vector where l is thenumber of filter coefficients.coeffs defaults to length lvector of zeros when you do notprovide the argument for input.

    ConversionFactor Conversion factor. Called gammawhen it is an input argument,it defaults to the matrix [1 -1]that specifies soft-constrainedinitialization.

    FilterLength Anypositiveinteger

    Reports the length of the filter,the number of coefficients or taps

    ForgettingFactor RLS forgetting factor. Thisis a scalar that should lie inthe range (1-0.5/l, 1]. lambdadefaults to 1.

    2-60

  • adaptfilt.ftf

    Name Range Description

    FwdPrediction Contains the predicted valuesfor samples during adaptation.Compare these to the actualsamples to get the error andpower.

    InitFactor Soft-constrained initializationfactor. This scalar should bepositive and sufficiently largeto prevent an excessive numberof Kalman gain rescues. deltadefaults to one.

    KalmanGain Empty when you co