| 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 |
Beginning with R2009a, users can specify and design filters at the command line using fdesign and design. The use of fdesign and design provides a powerful and efficient way to specify and implement digital filters. With fdesign and design, digital filter design is a two-step process. In the first step, the user specifies the desired characteristics of the filter and saves those specifications in a Filter Specification Object. In the second step, the user implements the filter as a dfilt object, which can then be used to filter data. As an example of this two-step process, we will design a lowpass filter for data sampled at 20 kHz. The desired passband frequency is 1 kHz with a stopband frequency of 1.2 kHz. We will limit the passband ripple to 1 dB and require 60 dB of attenuation between the passband and stopband frequencies.
To specify the filter use fdesign.lowpasswith the parameters given above. You can copy and paste the following code at the MATLAB command prompt.
d=fdesign.lowpass('Fp,Fst,Ap,Ast',1000,1200,1,60,20000);To design the filter use design with the appropriate design methods. In this example, we create FIR equiripple and IIR Butterworth designs and compare the filters' magnitude responses.
Hd1=design(d,'equiripple'); %FIR equiripple design Hd2=design(d,'butter'); %Butterworth design Hd=[Hd1 Hd2];%filter object with both designs %compare filters fvtool(Hd,'legend','on'); axis([0 2 -70 10])

To determine which filter design methods are available for a given Filter Specification Object, use designmethods. For the lowpass filter example above, you have a choice of two FIR and four IIR digital filter designs.:
designmethods(d) Design Methods for class fdesign.lowpass (Fp,Fst,Ap,Ast): butter cheby1 cheby2 ellip equiripple kaiserwin
For more detailed information on filter specification and implementation objects see Designing a Filter in Fdesign — Process Overview.
![]() | Exporting Filters from FDATool | Where to Find More Information | ![]() |

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 |