EE518 Digital University of Washington Autumn 2001 Dept. of Electrical Engineering Lecture 16: Filter Design: and Nov 26, 2001

Prof: J. Bilmes TA: Mingzhou Song

16.1 Introduction to Filter Design

Filter design is the most important practical application of this course.

– Filter, any modification of the signal according to design specifications.

– Frequency selectivity

– Causal filters (real time without delay)

– Note ideal filters are not realizable. We can’t have perfect magnitude response. For example, the ideal low pass filter is not realizable because it requires infinite length sinc function. We would like causal filters:

– IIR ok – FIR sometimes even better

Ex: typical way to specify low pass filter Design specifications for a low pass filter is shown in Fig 16.1.

|H(e jω)|

1 + δ1 Transition

1 − δ1 PSfrag replacements

Passband Stopband

δ2

ωp ωs π ω

Figure 16.1: Low pass filter design specifications.

16-1 16-2

In the low pass filter, δ1 is the tolerance at the pass band, δ2 is the tolerance at the stop band. In transition band, we do not care too much about what happens. The quantitative relationship for the maganitude response within the pass band and stop band are given as follows:

jω 1 − δ1 ≤ |H(e | ≤ 1 + δ1, |ω| ≤ ωp jω |H(e | ≤ δ2, ωs ≤ ωp ≤ π

−6 −9 where δ1 and δ2 are usually small positive numbers, e.g., δ1 can be 10 or 10 . Usually discrete time filter designis done in terms of normalized discrete time. Normalization in time by T is equivalent to normalization in frequency by 1/T. So in frequency domain, π/T is normalized to π. Or even sometimes for plotting, frquency is further normalized by π and a normalized 1 corresponds to π in radians. Note:

– If we use linear phase systems, we can just specify magnitude response, which will produce a system with only a delay and is easy to deal with.

– If we use IIR system, we might have to deal with phase.

There are two different design procedures:

1) start with continuous time filter and then map it to a discrete time filter. So we can use analog techniques to do filter design.

2) use new techniques to design filter directly in discrete time.

16.2 Design of Discrete Time Filter from Continuous Time Filter

We can apply transform technique to obtain H(z) and h[n] for discrete time fiters from Hc(s) and hc(t) as shown below:

H (s) H(z) c Transform Techniques hc(t) h[n]

Recall Laplace transfrom, a generalization of Fourier transform, is defined as

∞ X(s) = x(t)e−st dt (16.1) Z−∞ Plugging jΩ into X(s) we get Fourier transform X( jΩ). Here is a summary of three continuous time low pass filters.

Butterworth Filters

The magnitude response of Butterworth filters are in the following form 1 |Hc( jΩ)| = 2N (16.2) 1 + (Ω/Ωc) as shown in Fig 16.2 Properties:

1) N-th order filter has first (2N − 1) derivatives of |Hc( jΩ)|. The derivatives are zero at Ω = 0. 16-3

1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0 0 5 10 15 20 25 30 35 40 f (Hz)

Figure 16.2: Magnitude response of Butterworth filters.

2) monotonic in stop and pass band. 3) It is hard to control where approximately the tolerance will be. 4) Error reduces as N increases, but the filter is harder to implement.

Chebychev Filters

The magnitude response of Chebychev filters is 1 |H ( j )| = (16.3) c Ω 2 2 1 + ε VN (ω/ωc) where −1 VN(x) = cos(N cos x)

Note VN(x) can be described by the following initial values and recurrence equation:

N = 0, V0(x) = 1 −1 N = 1, V1(x) = cos(cos x) = x −1 2 N = 2, V2(x) = cos(N cos x) = 2x − 1

VN+1(x) = 2xVN(x) −VN−1(x)

The magnitude response of Chebychev filter is shown in Fig 16.3. Properties:

1) equiripple in passband (resp. stop band) and monotonic in the stop band (resp. pass band) for type I (resp type II) filters. 2) better for design to have error distributed over pass band or stop band by equiripple and can often lower N which leads to simpler implementation.

Elliptic Filters

The magnitude response of Elliptic filters is 1 |H ( j )| = (16.4) c Ω 2 2 1 + ε VN (Ω) 16-4

1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0 0 5 10 15 20 25 30 35 40 f (Hz)

Figure 16.3: Magnitude response of Chebychev filters.

where VN(Ω) is a Jacobian elliptic function. The magnitude response of elliptic filter is shown in Fig 16.4.

1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0 0 5 10 15 20 25 30 35 40 f (Hz)

Figure 16.4: Magnitude response of elliptic filters.

Error distribute over both pass band and stop band. This is as best as can be done for given Ωp, δ1, δ2, and transitive region (Ωp to Ωs).

16.2.1 Impulse Invariance

Sampling the continuous time impulse response with sampling period Td, we obtain

h[n] = Tdhc(nTd)

Then ∞ jω ω 2π H(e ) = ∑ Hc( j + j k) k=−∞ Td Td

If Hc( jΩ) = 0 for |Ω| ≥ π/Td, jω H(e ) = Hc( jω/Td) |ω| ≤ π 16-5

Will occur for the previous Hc( jΩ)? Yes. Consider Butterworth filter. But if order of filter N is high enough, aliasing will be small enough to be acceptable, i.e., within our tolerance δ2.

Question: Can we control aliasing by changing Td, the sampling period?

Choose cut-off frequency ωc in discrete time. Transform to Ωc = ωc/Td. Larger Td needs a continuous filter with larger Ωc and wider frequency spread, so Td doesn’t control aliasing. Aliasing can is controlled by order N and types of filters.

Question: How to choose Td?

Choose Td so that relevant details of hc(t) is captured.

Continuous to Discrete-Time in terms of Laplace to z-Transform

If a causal LTI system has N Ak Hc(s) = ∑ k=1 s − sk then the impulse response is 0 t < 0 ( ) = hc t N skt  ∑k=1 Ake t ≥ 0

By impulse response, N N n sknTd skTd h[n] = Tdhc(nTd) = u[n] ∑ TdAke = u[n] ∑ TdAk e k=1 k=1  and N T A H(z) = d k ∑ skTd −1 k=1 1 − e z s T The pole at s = sk in s-plane become pole at z = e k d in z-plane. That a stable and causal Hc(s) has Re(sk) < 0 for all its poles implies H(z) is also stable and causal because all the poles must have |eskTd | < 1, i.e. with the unit circle in z-plane. However, zeros have a more complex mapping. Note: impulse invariance works only for bandlimited filters, i.e., not continuous time high pass filters since that would cause big aliasing.

16.2.2 Bilinear Transform

We can find z-transform directly from by mappling the jΩ axis in s-plane to the unit circle on z-plane, i.e., −∞ < Ω < ∞ maps to −π < ω < π, which is a non-linear mapping. The bilinear transform is defined by 2 1 − z−1 H(z) = Hc −1 (16.5) Td 1 + z  which is accomplished by replacing s using 2 1 − z−1 s = −1 (16.6) Td 1 + z Note Td has no effect again. Points:

1) Left half of s-plane mapping to inside of the unit circle in z-plane, i.e., s = σ + jΩ, σ < 0 → |z| < 1 16-6

2) Right half of s-plane mapping to outside of the unit circle in z-plane, i.e.,

s = σ + jΩ, σ > 0 → |z| > 1

Hence, a causal and stable continuous time system will be mapped to a causal and stable discrete-time system.

3) jΩ is mapped to unit circle. Why?

1 + (T /2)s 1 + σ(T /2) + jΩ(T /2) z = d = d d 1 − (Td/2)s 1 − σ(Td/2) − jΩ(Td/2) When σ = 0, 1 + jΩ(T /2) z = d 1 − jΩ(Td/2) which says |z| = 1

Why is unit circle spanned? 2 1 − e− jω 2 σ + jΩ = s = − jω = j tan(ω/2) Td 1 + e Td So we have 2 Ω = tan(ω/2) Td σ =0

Therefore −1 ω = 2tan (ΩTd/2) which is shown in Fig 16.5

ω π PSfrag replacements

0 Ω

−π

Figure 16.5: ω − Ω plot for bilinear transform.

An example is shown in Fig 7.8 (O&S, pg 452).

Some of the bilinear transform mapping relationships are shown in Fig 16.6. Points:

1) σ < 0 ←→ |z| < 1

2) σ > 0 ←→ |z| > 1

3) jΩ ←→ e jω 16-7

jΩ

s-plane

2/Td

−4/Td −2/Td 0 1/Td 2/Td 4/Td σ

−2/Td

z-plane

|z| = 1 PSfrag replacements

−1/Td −3 −2 0 1 2 3

−1

Figure 16.6: Bilinear mapping between s-plane and z-plane. 16-8

4) real axis mappling

– the black “x” at z = −1 comes from s = ∞ and s =  j∞. – the red “x” at z = 1 comes from s = 0.

– as s goes from −∞ to 0, z goes from −1 to 1. z = 0 at s = −2/Td (light green “x”).

– as s goes from 0 to 2/Td, z goes from 1 to ∞.

– as s goes from 2/Td to ∞, z goes from −∞ to −1. 5) the yellow line moves up, smaller yellow circles.

6) the pink line moves down, smaller pink circles.

7) light blue circle bigger than red circle (|z| = 1) is vertical line between σ = 0 and σ = 2/Td. 8) dark blue circle (on the left) is vertical s-plane line.

Other notes:

– this produces both frequency warping and phase warping, i.e., linear phase in continuous time maps to non-linear phase in discrete time.

– the technique is particularly good idealized functions that are piecewise constant such as high-pass filters (HPF), low-pass filters (LPF), band-pass filters (BPF), etc., since they are easy to analyze in terms of the endpoints where the responses change.