| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Signal Processing Toolbox |
| Contents | Index |
| Learn more about Signal Processing Toolbox |
h = design(d)
h = design(d,designmethod)
h = design(d,designmethod,specname,specvalue,...)
h = design(d) uses a filter specification object d to generate a filter h. When you do not provide a design method as an input argument, design chooses the design method to use by following these rules in the order listed.
When equiripple does not apply to d, use another FIR design method, such as firls.
If FIR design methods do not apply to d, use ellip.
When ellipdoes not apply to d, use another IIR design method, such as butter or cheby1, that applies to the object d.
For more guidance about using design to design filters, refer to Designing a Filter in Fdesign — Process Overview. There you find examples that use design to design filters and use methods in the toolbox to analyze them. Alternatively, you can type the following at the MATLAB command prompt to obtain more information:
help design
h = design(d,designmethod) lets you specify a valid design method to design the filter as an input string. Note that the filter returned by design changes depending on the design method you choose. For more information about the filter that a design method returns, refer to the help for the design method.
The design method you provide as the designmethod input argument must be one of the methods returned by
designmethods(d)
for the specifications object d.
Valid entries depend on d. This is the complete set of design methods. The methods that apply to a specific specifications object usually represent a subset of this list.
butter
cheby1
cheby2
ellip
equiripple
firls
kaiserwin
window
To help you design filters more quickly, the input argument designmethod accepts a variety of special keywords that force design to behave in different ways. The following table presents the keywords you can use for designmethod 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. Refer to Examples to see this in use. |
Keywords are not case sensitive and must be enclosed in single quotation marks like any string input.
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)
at the MATLAB prompt.
h = design(d,designmethod,specname,specvalue,...) with this syntax you can specify not only the design method but also values for the filter specifications in the method. Provide the specifications in the order of the name of the specification, such as the FilterOrder, followed by the value to assign to the specification. Enter as many specname/specvalue pairs as you need to define your filter. Any specification you do not define uses the default specification value. To use the specname/specvalue syntax, you must provide the design method to use in designmethod.
To demonstrate some of the design options, these examples use a few different input arguments and output arguments. For the first example, use design to return the default filter based on the default equiripple design method .
d=fdesign.lowpass('Fp,Fst,Ap,Ast',0.2,0.22,1,60);
Hd = design(d) % Uses the default equiripple method.
Hd =
FilterStructure: 'Direct-Form FIR'
Numerator: [1x202 double]
PersistentMemory: false In this example, use the allfir keyword with design to return an FIR filter for each valid design method for the specifications in specifications object d.
designmethods(d) Design Methods for class fdesign.lowpass (Fp,Fst,Ap,Ast): butter cheby1 cheby2 ellip equiripple kaiserwin hallfir=design(d,'allfir') hallfir = dfilt.dffir dfilt.dffir
hallfir contains filters designed using the equiripple and kaiserwin design methods, in the order shown by designmethods(d)..
To see an individual filter, use an index with the filter object. For example, to see the second filter in hallfir, enter hallfir(2)
hallfir(2)
ans =
FilterStructure: 'Direct-Form FIR'
Numerator: [1x365 double]
PersistentMemory: false
This final example uses equiripple to design an FIR filter with the density factor set to 20 by using the specname/specvalue syntax.
hd= design(d,'equiripple','densityfactor',20)
hd =
FilterStructure: 'Direct-Form FIR'
Numerator: [1x202 double]
PersistentMemory: false designmethods, designopts, fdesign,
![]() | demod | designmethods | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |