Signal Processing Toolbox |

**Classical IIR Filter Design Using Analog Prototyping**

The principal IIR digital filter design technique this toolbox provides is based on the conversion of classical lowpass analog filters to their digital equivalents. The following sections describe how to design filters and summarize the characteristics of the supported filter types. See Special Topics in IIR Filter Design for detailed steps on the filter design process.

**Complete Classical IIR Filter Design**

You can easily create a filter of any order with a lowpass, highpass, bandpass, or bandstop configuration using the filter design functions.

Filter Type |
Design Function |

Bessel (analog only) |
`[b,a]` `[z,p,k]` `[A,B,C,D]` |

Butterworth |
`[b,a]` `[z,p,k]` `[A,B,C,D]` |

Chebyshev Type I |
`[b,a]` `[z,p,k]` `[A,B,C,D]` |

Chebyshev Type II |
`[b,a]` `[z,p,k]` `[A,B,C,D]` |

Elliptic |
`[b,a]` `[z,p,k]` `[A,B,C,D]` |

By default, each of these functions returns a lowpass filter; you need only specify the desired cutoff frequency `Wn`

in normalized frequency (Nyquist frequency `=`

1 Hz). For a highpass filter, append the string `'high'`

to the function's parameter list. For a bandpass or bandstop filter, specify `Wn`

as a two-element vector containing the passband edge frequencies, appending the string `'stop'`

for the bandstop configuration.

Here are some example digital filters:

[b,a] = butter(5,0.4); % Lowpass Butterworth [b,a] = cheby1(4,1,[0.4 0.7]); % Bandpass Chebyshev Type I [b,a] = cheby2(6,60,0.8,'high'); % Highpass Chebyshev Type II [b,a] = ellip(3,1,60,[0.4 0.7],'stop');% Bandstop elliptic

To design an analog filter, perhaps for simulation, use a trailing `'s'`

and specify cutoff frequencies in rad/s:

All filter design functions return a filter in the transfer function, zero-pole-gain, or state-space linear system model representation, depending on how many output arguments are present.

**Designing IIR Filters to Frequency Domain Specifications**

This toolbox provides order selection functions that calculate the minimum filter order that meets a given set of requirements.

These are useful in conjunction with the filter design functions. Suppose you want a bandpass filter with a passband from 1000 to 2000 Hz, stopbands starting 500 Hz away on either side, a 10 kHz sampling frequency, at most 1 dB of passband ripple, and at least 60 dB of stopband attenuation. You can meet these specifications by using the `butter`

function as follows.

[n,Wn] = buttord([1000 2000]/5000,[500 2500]/5000,1,60) n = 12 Wn = 0.1951 0.4080 [b,a] = butter(n,Wn);

An elliptic filter that meets the same requirements is given by

[n,Wn] = ellipord([1000 2000]/5000,[500 2500]/5000,1,60) n = 5 Wn = 0.2000 0.4000 [b,a] = ellip(n,1,60,Wn);

These functions also work with the other standard band configurations, as well as for analog filters; see Function Reference for details.

IIR Filter Design | Comparison of Classical IIR Filter Types |

© 1994-2005 The MathWorks, Inc.