Main Content

equiripple

Equiripple single-rate FIR filter from specification object

Syntax

equiFilt = design(d,'equiripple','SystemObject',true)
equiFilt = design(d,'equiripple',designoption,value,...,'SystemObject',true)

Description

equiFilt = design(d,'equiripple','SystemObject',true) designs an equiripple FIR digital filter using the specifications supplied in the object d. Equiripple filter designs minimize the maximum ripple in the passbands and stopbands.

When you use equiripple with Nyquist filter specification objects, you might encounter design cases where the filter design does not converge. Convergence errors occur mostly at large filter orders, or small transition widths, or large stopband attenuations. These specifications, alone or combined, can cause design failures. For more information, refer to fdesign.nyquist in the online Help system.

equiFilt = design(d,'equiripple',designoption,value,...,'SystemObject',true) returns an equiripple FIR filter where you specify design options as input arguments.

To determine the available design options, use designopts with the specification object and the design method as input arguments as shown.

designopts(d,'method')

For complete help about using equiripple, refer to the command line help system. For example, to get specific information about using equiripple with d, the specification object, enter the following at the MATLAB prompt.

help(d,'equiripple')

Examples

collapse all

Design a single-rate filter from a halfband filter specification object. Note the help command that gives more information on the options for the specification object and method.

d = fdesign.halfband('tw,ast',0.1,80);
designmethods(d,'Systemobject',true)
Design Methods that support System objects for class fdesign.halfband (TW,Ast):


butter
ellip
iirlinphase
equiripple
kaiserwin
help(d,'equiripple')
 DESIGN Design a Equiripple FIR filter.
    HD = DESIGN(D, 'equiripple') designs a Equiripple filter specified by the
    FDESIGN object D, and returns the DFILT/MFILT object HD.
 
    HD = DESIGN(D, ..., 'SystemObject', true) implements the filter, HD,
    using a System object instead of a DFILT/MFILT object.
 
    HD = DESIGN(..., 'FilterStructure', STRUCTURE) returns a filter with the
    structure STRUCTURE.  STRUCTURE is 'dffir' by default and can be any of
    the following:

    'dffir'
    'dffirt'
    'dfsymfir'
    'fftfir'
 
    Some of the listed structures may not be supported by System object
    filters. Type validstructures(D, 'equiripple', 'SystemObject', true) to
    get a list of structures supported by System objects.
 
    HD = DESIGN(..., 'MinPhase', MPHASE) designs a minimum-phase filter
    when MPHASE is TRUE.  MPHASE is FALSE by default.
 
    HD = DESIGN(..., 'StopbandShape', SHAPE) designs a filter whose stopband
    has the shape defined by SHAPE.  SHAPE can be 'flat', '1/f', or 'linear'.
    SHAPE is 'flat' by default.

    HD = DESIGN(..., 'StopbandDecay', DECAY) specifies the decay to use when
    'StopbandShape' is not set to 'flat'.  When the shape is '1/f' this
    specifies the power that 1/f is raised.  When shaped is 'linear' this
    specifies the slope of the stopband in dB/rad/s.
 
    % Example #1 - Design a halfband lowpass equiripple filter with increased stopband attenuation.
       TW = 0.1; % Transition Width
       Ast = 80; % Stopband Attenuation (dB)
       h  = fdesign.halfband('Type','Lowpass','TW,Ast',TW,Ast);
       Hd = design(h, 'equiripple', 'StopbandShape','linear','StopbandDecay',50);
 
designopts(d,'equiripple')
ans = struct with fields:
    FilterStructure: 'dffir'
           MinPhase: 0
      StopbandShape: 'flat'
      StopbandDecay: 0
       SystemObject: 0

equiFilt = design(d,'equiripple','stopbandshape','flat','SystemObject',true);

The frequency response of the filter shows the equiripple nature of the filter.

filterAnalyzer(equiFilt);

This example designs an equiripple filter with a direct-form transposed structure by specifying the 'FilterStructure' argument. To set the design options for the filter, use the designopts method and options object opts.

d = fdesign.lowpass('fp,fst,ap,ast');
opts = designopts(d,'equiripple');
opts.FilterStructure='dffirt';
opts.DensityFactor=20
opts = struct with fields:
    FilterStructure: 'dffirt'
      DensityFactor: 20
           MinPhase: 0
           MaxPhase: 0
           MinOrder: 'any'
      StopbandShape: 'flat'
      StopbandDecay: 0
        UniformGrid: 1
       SystemObject: 0

firFilt = design(d,'equiripple','SystemObject',true,opts)
firFilt = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form transposed'
      NumeratorSource: 'Property'
            Numerator: [-0.0024 -0.0021 0.0068 0.0167 0.0111 -0.0062 -0.0084 0.0093 0.0130 -0.0101 -0.0183 0.0114 0.0262 -0.0125 -0.0380 0.0134 0.0581 -0.0141 -0.1027 0.0145 0.3172 0.4854 0.3172 0.0145 -0.1027 -0.0141 0.0581 0.0134 ... ] (1x43 double)
    InitialConditions: 0

  Use get to show all properties

filterAnalyzer(firFilt);

The MaxPhase design option for equiripple FIR filters is currently only available for lowpass, highpass, bandpass, and bandstop filters.

Version History

Introduced in R2011a

See Also

Functions