Académique Documents
Professionnel Documents
Culture Documents
Giuseppe Scarpa
ENS 2013
Contents
1 Introduction 2
2 CT lowpass 3
2.1 The Butterworth approximation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 The Chebyshev approximation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 The inverse Chebyshev or Chebyshev II approximation . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4 The elliptic or Cauer approximation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3 CT to DT 11
3.1 Impulse-invariance transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 Bilinear transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Lowpass examples 19
5 Frequency transformations 21
5.1 Continuous-time frequency transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.2 Discrete-time frequency transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6 M ATLAB examples 24
1
1 Introduction to the IIR filter design problem
Key observation: A practically realizable IIR (in particular a causal one) cannot have a linear phase response
The approximation concerns magnitude AND phase response
The direct optimization according to any given criterion becomes a very complex task
The canonical design paradigm for IIR moves the problem to the continuous-time domain.
In addition, for selective filters like BP, HP, SB it is custom to design a lowpass in the CT domain and the apply a
frequency band transformation.
The frequency band transformation can be carried both in the CT and the DT domains, resulting in two possible
approaches:
FIR vs IIR
Advantages of FIR:
possibility to have exact linear phase
always stable with finite-duration transients
design methods generally linear in filter parameters
flexibility in the choice of the frequency response
Advantages of IIR:
2
2 Design of continuous-time lowpass filter
Magnitude-squared response
Let us start analysing some properties of the magnitude-squared response of a real-coefficients CT system. We can
write:
|Hc (j)|2 = Hc (j)Hc (j) = Hc (j)Hc (j) = Hc (s)Hc (s)|s=j
Therefore:
(2 + 12 )(2 + 22 ) (2 + M
2
)
|Hc (j)|2 = G2 2 2 2 2 2 2
( + s1 )( + s2 ) ( + sN )
For real system zeros and poles are either real o pairs of complex conjugate ones:
real (2 + s2k ) R+
complex conjugate s1 = rej , s2 = rej :
rational function in 2
differentiable
For these reasons it is typically preferred to |Hc (j)| for the design of continuous-time filters.
Observe, also, that due to the causality and stability requirements the phase response cannot be assigned indepen-
dently.
In continuous-time lowpass filter design, the magnitude-squared function is usually put in the following form:
(
2 1 V 2 () << 1, < c
|Hc (j)| = ,
2
1 + V () V 2 () >> 1, > c
zeros and poles of Hc (s)H(s) are symmetrically located wrt both the real and the imaginary axes (quadrantal
symmetry)
hence, causal and stable systems are obtained by picking poles from the left-half plane
if zeros are taken from the left-half plane as well, than minimum phase is also achieved
3
Analog specification
|H(j)|2
Specifications Transition band
Relative Analog
Passband
0 1 Ideal Response
Ap
1
1+2
As Passband Stopband ripple
ripple
1 Stopband
A2
p c s
Passband edge Stopband edge
Cutoff-freq.
Properties:
|HB (j0)|2 = 1
|HB (j)|2 = 0
|HB (jc )|2 = 1/2 (c is the 3dB cutoff frequency for all N )
Maximally flat
Asymptotic rolloff 6N dB/oct.
Ideal LP (N = )
1 |HB (j)|2
1/2
N
Pole locations
The solution of the equation 1 + (s/jc )2N = 0 yields the 2N poles:
(
k = c cos k
sk = k + jk , where
k = c sin k
with
2k 1
k , + , k = 1, 2, . . . , 2N
2 2N
4
/N I{s} I{s}
s1 s12 s1 s10
N =6 N =5
s2 s11
s2 s9
s3 s10
c s3 s8
s4 s9 R{s} R{s}
s4 s7
s5 s8
s6 s7 s5 s6
Nc
HB (s) =
(s s1 )(s s2 ) (s sN )
Design procedure
Let p , s , Ap and As be the specifications. We want to find the filter parameters c and N .
To satisfy the specification we need:
(
1 1
1+(p /c )2N
1+2 (p /c )2N 2
1 1
1+(s /c )2N
A2 (s /c )2N A2 1
p A2 1
N
= s N
c A 2 1 p N
Solving wrt N :
ln s 1p 2 10As /10 1
N , where , , , A 1= p
ln p 10Ap /10 1
Observe:
the left limit satisfy exactly the specifications at p
the right limit satisfy exactly the specifications at s
if we want smaller ripple in the bandpass, than we take the right limit
5
M ATLAB functions for analog Butterworth lowpass
The SP toolbox provides the following functions:
[N,Omegac] = buttord(Omegap,Omegas,Ap,As,s)
[C,D] = butter(N,Omegac,s)
where C and D are the numerator and denominator polynomials of the system function.
Example: design of a Butterworth lowpass filter [buttex.m]
Specifications:
Fp = 40Hz, Fs = 50Hz, Ap = 1dB, As = 30dB
19
Fc = Oc/(2*pi)
Fc =
41.6902
[C, D] = butter(N,Oc,s);
% Plots...
% ...
2 1
EC (/c ) = 1 2 TN2 (/c ), || c
1 + 2 TN2 (/c )
A Chebyshev polynomial TN (x) is defined for any value of x, and not just on the interval [1, 1]
However the formula used for TN (x) in the passband
6
|x| 1: T = cos(N*acos(x))
|x| > 1: T = cosh(N*acosh(x))
|HC (j)| N =4
N =6
1 N =7
1
1+2
Pole locations
The solution of the equation 1 + 2 TN2 (s/jc ) = 0 yields the 2N poles:
(
k = [c sinh()] cos k
sk = k + jk , where
k = [c cosh()]] sin k
with
2k 1
k , + , k = 1, 2, . . . , 2N
2 2N
and
1 1
, sinh1
N
It can be shown that the poles lie on an elliptic curve elongated in direction of the vertical axis
By selecting the poles lying on the left-half plane ({sk }, k = 1, 2. . . . , N ) we get a stable and causal system with
system function: (
N
Y
G 1/ 1 + 2 , N even
HC (s) = QN , G= (sk )
k=1 (s sk ) k=1
1, N odd
with G selected to satisfy the normalization condition on HC (j0).
7
Design procedure
Given p , s , Ap and As find c and N .
To satisfy the specification we need:
( 1 1
2 ( / )
1+2 TN
1+2 c = p
1
p c
1 1
2 ( / )
1+2 TN s p
A2 TN (s /p ) A2 1
where C and D are the numerator and denominator polynomials of the system function.
Example: design of a Chebyshev I lowpass filter [cheb1ex.m]
Specifications:
Fp = 40Hz, Fs = 50Hz, Ap = 1dB, As = 30dB
40
[C, D] = cheby1(N,Ap,Oc,s);
% Plots...
% ...
8
2.3 The inverse Chebyshev or Chebyshev II approximation
To convert a Chebyshev I to a Chebyshev II we need two steps:
c / /c
Complement to 1 of |HC (j)|2
1 1 1
1
A2 1 A2 1 1+2
A2 A2
1
2 2 A2
1+2 1+2
1 /c 1 /c 1 /c
Therefore:
1 2 TN2 (c /)
|HIC (j)|2 , 1 =
1 + 2 TN2 (c /) 1 + 2 TN2 (c /)
Observe the maximally flat behaviour in the passband.
Poles:
2c
TN (jc /s) = j/ sk =
k + jk
where k and k are the same coefficients defined for the Chebyshev I , that is:
k = [c sinh()] cos k
= [ cosh()]] sin
k c k
k , 2 + 2k1
, k = 1, 2, . . . , 2N
2N
1 1 1
, N sinh
Observe that the poles do not lie on any geometric curve, while the zeros are located on the imaginary axis.
Design by M ATLAB
The design procedure is similar to that of Chebyshev I, except that the roles of passband and stopband are inter-
changed, that is:
c is anchored to s
N is determined to satisfy the specifications in the passband
The M ATLAB SP Toolbox provides the necessary functions:
[N,Ws] = cheb2ord(Omegap,Omegas,Ap,As,s)
[C,D] = cheby2(N,As,Ws,s)
9
where C and D are the numerator and denominator polynomials of the system function. Ws is the exact stopband edge
frequency.
Example: design of a Chebyshev II lowpass filter [cheb2ex.m]
Specifications:
Fp = 40Hz, Fs = 50Hz, Ap = 1dB, As = 30dB
Fs = Ws/(2*pi)
Fs =
49.8720
[C, D] = cheby2(N,As,Ws,s);
% Plots...
% ...
due to Cauer, and also referred to as elliptic filter, where the Chebyshev polynomial has been replaced by
2
2 1
2
23 2 22N 1 2
121 2 123 2
1 2 2, N even
RN () , 2N 1
2 2 2 2 2 2
2 2 2 2 2 4 2 2 2N2 2 , N odd
1 1
2 4 2N1
Design by M ATLAB
We skip heavy analytical aspects concerning the design of Cauer filters, focusing on the M ATLAB based design.
As usual one function computes the filter parameters, the other singles out the system function:
[N,Oc] = ellipord(Omegap,Omegas,Ap,As,s)
[C,D] = ellip(N,Ap,As,Oc,s)
where C and D are the numerator and denominator polynomials of the system function. Oc is the passband edge
frequency p .
Example: design of a Cauer lowpass filter [cauerex.m]
Specifications:
Fp = 40Hz, Fs = 50Hz, Ap = 1dB, As = 30dB
10
Op = 2*pi*40; Os = 2*pi*50; Ap = 1; As = 30;
[N,Oc] = ellipord(Op,Os,Ap,As,s); N
N =
5
[C, D] = ellip(N,Ap,As,Oc,s);
% Plots...
% ...
Comparison
A mapping function s = f (z) from s-plane to z-plane should satisfy the three following conditions, in order to
ensure the practical realizability:
left-half s-plane mapped into the interior of the unit circle of the z-plane
Spectral domain:
11
The time-domain sampling corresponds to replication in the spectral domain (with possibility of aliasing!):
X
2
H(ej ) = Hc j +j k
Td Td
k=
N
X
h[n] = Td hc (nTd ) = Td Ak (esk Td )n u[n]
k=1
X X
X N N
X Td Ak
H(z) = h[n]z n = Td Ak (esk Td )n z n =
n=0 n=0 k=1
1 esk Td z 1
k=1
sk Td
provided |e | < 1.
Therefore the following pole mapping rule applies:
ln z
s= z = esTd
Td
Observe that this mapping rule does not apply for zeros.
Aliasing
The impulse-invariance transformation IS NOT a one-to-one mapping. In fact s1 = + j1 and s2 = + j2 ,
will be mapped into the same point z = eTd ej1 Td , if 1 2 = 2k
Td .
I{z}
sTd
z=e
z = ej
Td s = 2k
T d
1 R{z}
(2k+1)
T s= Td
d
3
T
d
X
2k
H(z)|z=esTd = Hc s + j
Td
k=
12
M ATLAB
The impulse-invariance transformation of a rational transfer function of a CT system can be done using:
[B,A] = impinvar(C,D,Fd)
where [C,D] and [B,A] are the numerator/denominator polynomial coefficients of the CT and its DT counterpart
system function, respectively.
Example: Impulse-invariance transformation
L 1
hc (t) = e2t u(t) Hc (s) = , Re [s] > 2
s+2
As already observed the first important limitation is the aliasing. The reduction of the aliasing effects can be
obtained by reducing Td
More in general if the system function Hc (s) is not a proper function, the technique cannot be applied at all.
The replication formula would not converge at all.
Example (Butterworth)
Specifications: p = 0.25, s = 0.4, Ap = 1dB, As = 30dB
[C,D] = butter(N,Oc,s);
1 Because of the aliasing, filters with equiripple behaviour in the stopband are unsuited
13
4. [B,A] = impinvar(C,D,1/Td);
N
N =
9
Example (Chebyshev I)
Specifications: p = 0.25, s = 0.4, Ap = 1dB, As = 30dB
N
N =
5
N
N =
5
14
3.2 Bilinear transformation
The bilinear transformation avoids the limitations of the impulse invariance due to the aliasing
It is a one-to-one nonlinear transformation between s-plane and z-plane
It is defined by the following relationship:
2 1 z1
s = f (z) ,
Td 1 + z 1
The design parameter Td is not subject to any limitation and can be chosen to simplify the analytical derivations
It satisfies all the realizability conditions and is the most popular mapping technique
Realizability
The bilinear transformation is formally obtained by:
H(z) = Hc (s)|s= 2 1z 1
Td 1+z 1
2 1 z 1 2 1 z 1 (1 + z 1 )k Td /2
s k = k =
Td 1 + z 1 Td 1 + z 1
2(1 Td k /2) 1 + Td k /2 1
= ... = 1 z
Td (1 + z 1 ) 1 Td k /2
Eventually:
1 + Td k /2
k
1 Td k /2
where
1+Td k /2 1+Td sk /2
zk =
1Td k /2 , pk = 1T d sk /2
Td N M QM
Td
0 2 k=1 1k 2
G = QN Td
k=1 1sk 2
Observe:
A rational Hc (s) always gives a rational H(z)
15
M ATLAB function for bilinear transformation
The M ATLAB bilinear transformation can be done either by zeros/poles mapping or by polynomial coefficients
conversion:
Mapping properties
Let z = rej and s = + j, therefore
2/Td + s 2/Td + + j
z = rej = =
2/Td s 2/Td j
hence
2 1/2
r < 1, if < 0
(2/Td + )2 +
r = |z| = r = 1, if = 0
(2/Td )2 + 2
r > 1, if > 0
and
= tan1 + tan1
2/Td + 2/Td
On the unit circle we have:
Td 2
= 2 tan1 = tan
2 Td 2
I{z}
s = f (z)
z = ej
s = j s=0
0 1 R{z}
s = j
16
the open left-half plane is mapped in the interior of the unit circle
j axis is mapped onto the unit circle
the open right-half plane is mapped outside the unit circle
= 0 = 0 and
NO ALIASING
causal and stable CT filters yield causal and stable DT filters
Frequency warping
The nonlinear relationship between and ,
1 Td 2
= 2 tan = tan ,
2 Td 2
gives rise to a nonlinear frequency scaling, known as frequency warping, which may cause distortion, both in magni-
tude and phase response.
10
10
2
8 = tan
8
Td 2
6
6
Linear
response
4
4
Flat 2
2
response
Linear
response /
1
|Hc (j)|
2
|H(ej )| Nonlinear
response
Linear Flat
response response
1
Observations:
since tan for small , then the relation between and is approximatively linear for || < 0.3 (no
warping)
in general flat responses cannot be distorted by the warping
warping distorts nonflat responses for || > 0.3 (Ex.: differentiators cannot be converted by bilinear transfor-
mation)
frequency bands are nonlinearly translated/scaled, thus prewarping is necessary:
2
k
k = tan
Td 2
The value Td can be feely set and it is usually set to Td = 2 to simplify the derivations
phase response is affected in similar manner. As consequence phase linearity is not preserved
17
Design procedure (lowpass)
Specification: p , s , Ap and As
1. Set Td = 2
(
p p = tan(p /2)
2.
s s = tan(s /2)
Example (Butterworth)
Specifications: p = 0.25, s = 0.4, Ap = 1dB, As = 30dB
N
N =
8
N
N =
5
18
4 Design examples for lowpass IIR filters
M ATLAB functions for bilinear transf.-based IIR design
M ATLAB provides functions to directly design discrete-time IIR, which incorporate the bilinear transformation.
These functions are overloads of the corresponding ones used for continuous-time filter design: buttord,
butter, cheb1ord, cheby1,... where the option parameter s is omitted.
(
[N,omegac] = buttord(omegap,omegas,Ap,As);
Butterworth
[B,A] = butter(N,omegac);
(
[N,omegac] = cheb1ord(omegap,omegas,Ap,As);
Chebyshev I
[B,A] = cheby1(N,A,pomegac);
(
[N,omegac] = cheb2ord(omegap,omegas,Ap,As);
Chebyshev II
[B,A] = cheby2(N,As,omegac);
(
[N,omegac] = ellipord(omegap,omegas,Ap,As);
Elliptic
[B,A] = ellip(N,Ap,As,omegac);
omegap p /, omegas s /
In the following we will show several realistic examples [iirlpexe.m] using the above functions
Example (Digital Butterworth lowpass)
Specifications: p = 0.2, s = 0.3, Ap = 1dB, As = 50dB
[N oc]
ans =
17 0.2218
19
op=0.3; os=0.4; Ap=0.5; As=60;
[N,oc] = cheb1ord(op,os,Ap,As);
[B,A] = cheb1(N,Ap,oc);
% Plots...
[N oc]
ans =
10 0.3000
[N oc]
ans =
12 0.4500
[N oc]
ans =
7 0.4000
20
5 Frequency transformations of lowpass filters
Although the frequency transformation can be performed both in CT and in DT domains, there are some limitations
in the CT case that make the DT frequency transformation more general
Therefore we will analyse the DT transformations in more detail, and will give a brief look at the CT case, just for
completeness.
In particular, the key limitation of CT frequency transformation is that the subsequent CT to DT conversion may
be heavily affected be aliasing, if the impulse-invariance is used
M ATLAB provides the following functions for analog filter conversion: lp2lp, lp2hp, lp2bp and lp2bs.
Example (Lowpass to bandpass analog conversion)
Specifications: Fp1 = 20Hz, Fp2 = 60Hz, Ap = 1dB, As = 40dB
% LP design (elliptic)
Omegap = 1; Omegas = 1.5;
[N,Omegac]=ellipord(Omegap,Omegas,Ap,As,s);
[C,D] = ellip(N,Ap,As,Oc,s);
% LP->PB transformation
Omega0=sqrt(Omegap1*Omegap2);% Geometric mean
BW = Omegap2-Omegap1;
[B,A] = lp2bp(C,D,Omega0,BW);
21
5.2 Discrete-time frequency transformations
Problem formulation
Constraints:
Rational H(z) G(z 1 ) rational in z 1
|w| < 1 |z| < 1 (to preserve stability)
|w| = 1 |z| = 1 (to be able to map the specifications)
(
j j jG(ej ) |G(ej )| = 1
e = |G(e )|e (allpass)
= G(ej )
General solution
It has been found that the most general allpass function satisfying the above conditions is
N
Y
1 1 z 1 k
w = G(z )= , with |k | < 1 k
1 k z 1
k=1
By properly choosing the values of N and k , we obtain a variety of mapping (see the following table for the most
useful ones)
Common discrete-time mappings LP(c ) LP(c ), HP(c ), BP(1 < 2 ), BS(1 < 2 )
22
LP(c ) HP(c )
As an example consider the LP HP transformation:
z 1 + ej +
w1 = G(z 1 ) = e j
=
1 + z 1 1 + ej
(1 2 ) sin
= tan1
2 + (1 + 2 ) cos
1 (1 2 ) sin
= tan
2 + (1 + 2 ) cos
In particular, the last equation allows the mapping of the desired band edge frequencies
The above nonlinear relationship between and (see picture) causes a frequency warping for 6= 0.
=
0.8
0.
8
=
0.
0.6
5
=
0.4
0
=
0.
0.2
=
5
0.
As in the bilinear transformation case, this warping does not distort piecewise-constant frequency response character-
istics.
1. p = 1rad
2. anchor the cutoff f. to the passband edge f.:
c = p and c = p
cos[(c +c )/2]
3. = cos[( c c )/2]
h i
(12 ) sin s
4. s = tan1 2+(1+ 2 ) cos
s
(prewarping of s )
23
4 ts=atan(-(1-al2)*sin(os)/
(2*al+(1+al2)*cos(os)));
5 % LP design (Chebyshev I)
[N,omegac]=cheb1ord(tp/pi,ts/pi,Ap,As);
[Blp,Alp] = cheby1(N,Ap,omegac);
1
z +
6 Given the prototype Hlp (z), it is easy to proceed analytically with the mapping z 1 = 1+z 1 ...
The function prototypes for all kinds (Butterworth, Chebyshevs,...) present the same formalism, therefore we can
refer to only one type (Elliptic) for details.
24
omegap = 0.7; Ap = 1; omegas = 0.5; As = 40;
[N,omegac] = buttord(omegap,omegas,Ap,As)
N =
8
omegac =
0.6739
[B,A] = butter(N,omegac,high);
% Plots...
Ap = 0.5; As = 50;
[N,omegac] = cheb1ord(omegap,omegas,Ap,As); N
N =
7
[B,A] = cheby1(N,Ap,omegac);
% Plots...
N =
5
[B,A] = cheby2(N,As,omegac,stop);
% Plots...
25
Example (Elliptic bandpass filter design) [ellipBP.m]
Specifications:
Lower stopband: [0, 0.2] Attenuation: 60dB
Passband: [0.3, 0.6] Ripple: 0.1dB
Upper stopband: [0.7, ] Attenuation: 60dB
Ap = 0.1; As = 60;
[N,omegac] = ellipord(omegap,omegas,Ap,As); N
N =
6
[B,A] = ellip(N,Ap,As,omegac);
% Plots...
26