The classic IIR filter design technique includes the following steps.
Find an analog lowpass filter with cutoff frequency of 1 and translate this prototype filter to the specified band configuration
Transform the filter to the digital domain.
Discretize the filter.
The toolbox provides functions for each of these steps.
Design Task  Available functions 

Analog lowpass prototype  
Frequency transformation  
Discretization 
Alternatively, the butter
, cheby1
, cheb2ord
, ellip
, and besself
functions perform all steps of the filter design and the
buttord
, cheb1ord
, cheb2ord
, and ellipord
functions provide minimum
order computation for IIR filters. These functions are sufficient for many design
problems, and the lower level functions are generally not needed. But if you do have
an application where you need to transform the band edges of an analog filter, or
discretize a rational transfer function, this section describes the tools with which
to do so.
This toolbox provides a number of functions to create lowpass analog prototype filters with cutoff frequency of 1, the first step in the classical approach to IIR filter design.
The table below summarizes the analog prototype design functions for each supported filter type; plots for each type are shown in IIR Filter Design.
The second step in the analog prototyping design technique is the frequency transformation of a lowpass prototype. The toolbox provides a set of functions to transform analog lowpass prototypes (with cutoff frequency of 1 rad/s) into bandpass, highpass, bandstop, and lowpass filters with the specified cutoff frequency.
Frequency Transformation  Transformation Function 

Lowpass to lowpass $${s}^{\prime}=s/{\omega}_{0}$$ 

Lowpass to highpass $${s}^{\prime}=\frac{{\omega}_{0}}{s}$$ 

Lowpass to bandpass $${s}^{\prime}=\frac{{\omega}_{0}}{{B}_{\omega}}\frac{{(s/{\omega}_{0})}^{2}+1}{s/{\omega}_{0}}$$ 

Lowpass to bandstop $${s}^{\prime}=\frac{{B}_{\omega}}{{\omega}_{0}}\frac{s/{\omega}_{0}}{{(s/{\omega}_{0})}^{2}+1}$$ 

As shown, all of the frequency transformation functions can accept two linear system models: transfer function and statespace form. For the bandpass and bandstop cases
$${\omega}_{0}=\sqrt{{\omega}_{1}{\omega}_{2}}$$
and
$${B}_{\omega}={\omega}_{2}{\omega}_{1}$$
where ω_{1} is the lower band edge and ω_{2} is the upper band edge.
The frequency transformation functions perform frequency variable substitution. In
the case of lp2bp
and lp2bs
, this is a secondorder substitution, so the output filter is
twice the order of the input. For lp2lp
and
lp2hp
, the output filter is the same order as the
input.
To begin designing an order 10 bandpass Chebyshev Type I filter with a value of 3 dB for passband ripple, enter
[z,p,k] = cheb1ap(10,3);
Outputs z
, p
, and k
contain the zeros, poles, and gain of a lowpass analog filter with cutoff frequency
Ω_{c} equal to 1 rad/s. Use the function to transform this
lowpass prototype to a bandpass analog filter with band edges Ω_{1} = π/5 and Ω_{2} = π. First, convert the filter to statespace form so the
lp2bp
function can accept it:
[A,B,C,D] = zp2ss(z,p,k); % Convert to statespace form.
Now, find the bandwidth and center frequency, and call
lp2bp
:
u1 = 0.1*2*pi;
u2 = 0.5*2*pi; % In radians per second
Bw = u2u1;
Wo = sqrt(u1*u2);
[At,Bt,Ct,Dt] = lp2bp(A,B,C,D,Wo,Bw);
Finally, calculate the frequency response and plot its magnitude:
[b,a] = ss2tf(At,Bt,Ct,Dt); % Convert to TF form w = linspace(0.01,1,500)*2*pi; % Generate frequency vector h = freqs(b,a,w); % Compute frequency response semilogy(w/2/pi,abs(h)) % Plot log magnitude vs. freq xlabel('Frequency (Hz)') grid
The third step in the analog prototyping technique is the transformation of the
filter to the discretetime domain. The toolbox provides two methods for this: the
impulse invariant and bilinear transformations. The filter design functions
butter
, cheby1
, cheby2
, and ellip
use the bilinear transformation for discretization in this
step.
Analog to Digital Transformation  Transformation Function 

Impulse invariance 

Bilinear transform 

The toolbox function impinvar
creates a digital filter
whose impulse response is the samples of the continuous impulse response of an
analog filter. This function works only on filters in transfer function form.
For best results, the analog filter should have negligible frequency content
above half the sampling frequency, because such highfrequency content is
aliased into lower bands upon sampling. Impulse invariance works for some
lowpass and bandpass filters, but is not appropriate for highpass and bandstop
filters.
Design a Chebyshev Type I filter and plot its frequency and phase response using FVTool:
[bz,az] = impinvar(b,a,2); fvtool(bz,az)
Click the Magnitude and Phase Response toolbar button.
Impulse invariance retains the cutoff frequencies of 0.1 Hz and 0.5 Hz.
The bilinear transformation is a nonlinear mapping of the continuous domain to the discrete domain; it maps the splane into the zplane by
$$H(z)=H(s){}_{s=k\frac{z1}{z+1}}$$
Bilinear transformation maps the jΩaxis of the continuous domain to the unit circle of the discrete domain according to
$$\omega =2{\mathrm{tan}}^{1}\left(\frac{\Omega}{k}\right)$$
The toolbox function bilinear
implements this operation,
where the frequency warping constant k is equal to twice the
sampling frequency (2*fs
) by default, and equal to $$2\pi {f}_{p}/\mathrm{tan}\left(\pi {f}_{p}/{f}_{s}\right)$$if you give bilinear
a trailing argument
that represents a “match” frequency Fp
. If a
match frequency Fp
(in hertz) is present,
bilinear
maps the frequency Ω =
2πf_{p} (in rad/s) to the same
frequency in the discrete domain, normalized to the sampling rate: ω =
2πf_{p}/f_{s}
(in rad/sample).
The bilinear
function can perform this transformation on
three different linear system representations: zeropolegain, transfer
function, and statespace form. Try calling bilinear
with the
statespace matrices that describe the Chebyshev Type I filter from the previous
section, using a sampling frequency of 2 Hz, and retaining the lower band edge
of 0.1 Hz:
[Ad,Bd,Cd,Dd] = bilinear(At,Bt,Ct,Dt,2,0.1);
The frequency response of the resulting digital filter is
[bz,az] = ss2tf(Ad,Bd,Cd,Dd); % Convert to TF
fvtool(bz,az)
Click the Magnitude and Phase Response toolbar button.
The lower band edge is at 0.1 Hz as expected. Notice, however, that the upper
band edge is slightly less than 0.5 Hz, although in the analog domain it was
exactly 0.5 Hz. This illustrates the nonlinear nature of the bilinear
transformation. To counteract this nonlinearity, it is necessary to create
analog domain filters with “prewarped” band edges, which map to
the correct locations upon bilinear transformation. Here the prewarped
frequencies u1
and u2
generate
Bw
and Wo
for the
lp2bp
function:
fs = 2; % Sampling frequency (hertz) u1 = 2*fs*tan(0.1*(2*pi/fs)/2); % Lower band edge (rad/s) u2 = 2*fs*tan(0.5*(2*pi/fs)/2); % Upper band edge (rad/s) Bw = u2  u1; % Bandwidth Wo = sqrt(u1*u2); % Center frequency [At,Bt,Ct,Dt] = lp2bp(A,B,C,D,Wo,Bw);
A digital bandpass filter with correct band edges 0.1 and 0.5 times the Nyquist frequency is
[Ad,Bd,Cd,Dd] = bilinear(At,Bt,Ct,Dt,fs);
The example bandpass filters from the last two sections could also be created
in one statement using the complete IIR design function
cheby1
. For instance, an analog version of the example
Chebyshev filter is
[b,a] = cheby1(5,3,[0.1 0.5]*2*pi,'s');
Note that the band edges are in rad/s for analog filters, whereas for the digital case, frequency is normalized:
[bz,az] = cheby1(5,3,[0.1 0.5]);
All of the complete design functions call bilinear
internally. They prewarp the band edges as needed to obtain the correct digital
filter.