Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Contents

design

Apply design method to filter specification object

Syntax

H = design(D)
H = design(D,METHOD)
H = design(D,METHOD,PARAM1,VALUE1,PARAM2,VALUE2,...)
H = design(D,METHOD,OPTS)
Hs = design(D,...,'SystemObject',sysobjflag)

Description

H = design(D) uses the filter specifications object D to generate a filter H. When you do not provide a design method as an input argument, design uses a default design method. Use designmethods(D,'default') to see the default design method for your filter specifications object.

H = design(D,METHOD) forces the design method specified by the string METHOD. METHOD must be one of the strings returned by designmethods. Use designmethods(D,'default') to determine which algorithm is used by default.

The design method you provide as the designmethod input argument must be one of the methods returned by

designmethods(d)

To help you design filters more quickly, the input argument METHOD accepts a variety of special keywords that force design to behave in different ways. The following table presents the keywords you can use for METHOD and how design responds to the keyword.

Designmethod Keyword

Description of the design Response

'FIR'

Forces design to produce an FIR filter. When no FIR design method exists for object D, design returns an error.

'IIR'

Forces design to produce an IIR filter. When no IIR design method exists for object D, design returns an error.

'ALLFIR'

Produces filters from every applicable FIR design method for the specifications in D, one filter for each design method. As a result, design returns multiple filters in the output object.

'ALLIIR'

Produces filters from every applicable IIR design method for the specifications in D, one filter for each design method. As a result, design returns multiple filters in the output object.

'ALL'

Designs filters using all applicable design methods for the specifications object D. As a result, design returns multiple filters, one for each design method. design uses the design methods in the order that designmethods(D) returns them.

Keywords are not case sensitive

When design returns multiple filters in the output object, use indexing to see the individual filters. For example, to see the third filter in H, enter

H(3)

H = design(D,METHOD,PARAM1,VALUE1,PARAM2,VALUE2,...) specifies design-method options. Use help(D,METHOD) for complete information on which design-method-specific options are available. You can also use designopts(D,METHOD) for a less-detailed listing of the design-method-specific options.

H = design(D,METHOD,OPTS) specifies design-method options using the structure OPTS. OPTS is usually obtained from designopts and then specified as an input to design. Use help(D,METHOD) for more information on optional inputs.

Hs = design(D,...,'SystemObject',sysobjflag) uses the filter specifications object D to generate a filter System object Hs when sysobjflag is true. To generate System objects, you must have the DSP System Toolbox™ product installed. When sysobjflag is false, the function generates a dfilt or mfilt object H, as described previously. Design methods and design options for filter System objects are not necessarily the same as those for dfilt and mfilt objects. To check design methods for System objects, use designmethods with the 'SystemObject',sysobjflag syntax.

If you are specifying design-method-specific options using OPTS, you can also set OPTS.SystemObject to true instead of calling design with the 'SystemObject',sysobjflag syntax.

Examples

Design an FIR equiripple lowpass filter. The passband edge frequency is 0.2π radians/sample, and the stopband edge frequency is 0.25π radians/sample. The passband ripple is 0.5 dB, and the stopband attenuation is 40 dB.

D = fdesign.lowpass('Fp,Fst,Ap,Ast',0.2,0.25,0.5,40);
H = design(D); % Uses the default equiripple method.

If you have the DSP System Toolbox software installed, you can design a minimum-phase FIR equripple filter. Design a minimum–phase filter and compare the pole-zero plots of the original and minimum-phase designs.

 
Hmin = design(D,'equiripple','MinPhase',true);
hfvt = fvtool([H Hmin],'analysis','polezero');
legend(hfvt,'Original Design','Minimum Phase Design');

Design a Butterworth lowpass filter. The passband edge frequency is 0.2π radians/sample, and the stopband edge frequency is 0.25π radians/sample. The passband ripple is 0.5 dB, and the stopband attenuation is 40 dB. Obtain help on the design options specific to the Butterworth design method. Design the filter with the "MatchExactly' option set to 'Passband'.

D = fdesign.lowpass('Fp,Fst,Ap,Ast',0.2,0.25,0.5,40);
% Query design-method-specific options
help(D,'butter')
% Match passband exactly
H = design(D,'butter','MatchExactly','passband');

If you have the DSP System Toolbox software, you can specify the P-th norm scaling on the second-order sections. Use L-infinity norm scaling in the time domain.

H = design(D,'butter','MatchExactly','passband','SOSScaleNorm','linf');

If you have the DSP System Toolbox software, you can create a filter System object.

Hs = design(D,'SystemObject',true);

See Also

|

Was this topic helpful?