### Notes of Digital Signal Analysis and Processing [CT 704]

#### IIR Filter Design

Filter Design by Impulse Invariance Method

Impulse Invariance Method

- The filter is designed to replace analog filter by digital filter.
- It is possible if impulse response of digital filter resembles the sampled version of impulse response of analog filter.
- The different notations used are as follows:
ha(t) = Impulse response in time domain
Ha(s) = Transfer function of analog filter
ha(nT) = Sampled version of ha(t)
H(z) = Response of digital filter = Z-transform of h(nT)
Ω = Analog frequency
w = Digital frequency

- The design steps are as follows:
1. Obtain Ha(s) from the given specifications.
2. Expand Ha(s) by using partial fraction expansion.
3. Obtain Z-transform using impulse invariance transformation equation.
4. The digital IIR filter H(z) is obtained.

Drawbacks

- Mapping from analog frequency Ω to digital frequency w is many to one.
- As analog filters are not band limited, there will be aliasing due to sampling such that frequency of resulting digital filter will not be identical to original frequency response of analog filter.
- The change in sampling time (T) has no effect on amount of aliasing.

Standard Equations

```1) 1 / (s - pi) ----> 1 / (1 - epiT . z-1)
2) (s+a) / {(s+a)2 + b2} ----> [1 - e-aT cosbT z-1] / [1 - 2e-aT cosbT z-1 + e-2aT z-2]
3) b / {(s+a)2 + b2} ----> [ e-aT sinbT z-1] / [1 - 2e-aT cosbT z-1 + e-2aT z-2]
```

Filter Design by Bilinear Transformation

Bilinear Transformation Method

- It is also suitable for high pass or band reject filters.
- It is a conformal mapping which transforms jΩ axis into the unit circle in z-plane only once.
- It is a one to one mapping from s domain to z domain.
- There is no aliasing effect.
- The frequency relationship is non linear.
- The poles are transferred using the function :
s = 2/T [ {1 - z-1} / {1 + z-1} ]

Design of Digital Low Pass Butterworth Filter

Butterworth Filter

- The characteristics of butterworth low pass filter is shown in given figure:

- There is no variations in the passband.

- The notations used are:
| H(Ω) | = Magnitude of analog LPF
Ωc = Cut off frequency
Ωp = Passband edge frequency
1 + ∈2 = Passband edge value
1 + δ2 = Stopband edge value
∈ = Parameter related to ripple in passband
δ = Parameter related to ripple in stopband
N = Order of filter.

- The max gain occurs at Ω = 0 and | H(0) | = 1.

Design of Butterworth Filter

Given:
Ap = Attenuation in passband
As = Attenuation in stopband
Ωp = Passband edge frequency
Ωc = Cut off frequency
Ωs = Stopband edge frequency

Step 1:
- From the given specification, obtain equivalent analog filter.
- For Inverse Invariance Method, Ω = w / T
- For Bilinear Transformation, Ω = 2 / T . tan w/2
where,
w = frequency of digital filter
Ω = frequency of analog filter
T = sampling time

Step 2:
- Evaluate order N of the filter:

```      N = 1/2 * { log[{1/As2 - 1} / {1/Ap2 - 1}] / log[Ωs / Ωp]}
```

- If given in decibel;

```      N = 1/2 * { log[{100.1As - 1} / {100.1Ap - 1}] / log[Ωs / Ωp]}
```

Step 3:
- Calculate cut off frequency
- For Inverse Invariance Method; Ωc = wc / T
- For Bilinear Transformation, Ωc = 2/T . tan wc/2
- If wc is not given:
Ωc = Ωp / {1/Ap2 - 1}1/2N
- If specification are in dB:
Ωc = Ωp / {100.1Ap - 1}1/2N

Step 4:
- Determine poles
- pi = (+ or -) Ωc . ej(N+2i+1)π/2N ; i = 0, 1, 2.........., N-1

Step 5:
- Calculate system transfer function of analog filter.
- Ha(s) = ΩcN / [(s-p1) . (s-p2) ........]

Q) Using bilinear transformation, design a digital filter satisfying given specifications.

```Given specifications:
0.8 <= | H(ejw) | <= 1    for 0 <= w <= 0.2π
| H(ejw) | <= 0.2    for 0.6π <= w <= π```

From the given specifications, we get:
Ap = 0.8
As = 0.2
wp = 0.2π
ws = 0.6π
Assume T = 1;

Step 1:
Calculate frequency of analog filter Ω.
For Bilinear Transformation,
Ω = 2 / T . tan w/2
Ωp = 2 / 1 . tan 0.2π/2 = 0.65
Ωs = 2 / 1 . tan 0.6π/2 = 2.75

Step 2:
Calculate order of filter (N).
N = 1/2 * { log[{1/As2 - 1} / {1/Ap2 - 1}] / log[Ωs / Ωp]}
N = 1/2 * { log[{1/0.22 - 1} / {1/0.82 - 1}] / log[2.75 / 0.65]}
N = 1.3
N = 2 (approx)

Step 3:
Calculate cut off frequency Ωc.
Ωc = Ωp / {100.1Ap - 1}1/2N
Ωc = 0.65 / {1/0.82 - 1}1/4
Ωc = 0.75

Step 4:
Find the poles pi.
We know,
pi = (+ or -) Ωc . ej(N+2i+1)π/2N ; i = 0, 1, 2.........., N-1
So,
p0 = (+ or -) 0.75 ej(3)π/4
p0 = (+ or -) 0.75 [ cos 3π/4 + j sin 3π/4] = (+ or -) {-0.53 + 0.53j}
Also,
p1 = (+ or -) 0.75 ej(5)π/4
p1 = (+ or -) 0.75 [ cos 5π/4 + j sin 5π/4] = (+ or -) {-0.53 - 0.53j}

Step 5:
Calculate Ha(s).
Taking the poles on LHS of the z-plane only.
Ha(s) = 0.752 / [(s-{-0.53+0.53j}) . (s-{-0.53-0.53j})]
Ha(s) = 0.5635 / [(s + 0.53)2 - (0.53j)2]
Ha(s) = 0.5635 / {s2 + 1.06s + 0.56}

Step 6:
Calculate H(z)
Using bilinear transformation:
Putting s = 2/T [ {1 - z-1} / {1 + z-1} ]

H(z) = 0.5625 / { 4[{1 - z-1} / {1 + z-1}]2 + 2.12 {1 - z-1} / {1 + z-1} + 0.56}
H(z) = 0.5625 (1 + 2z-1 +z-2) / 6.68 (1 - 1.03z-1 +0.37z-2)
H(z) = 0.084 (1 + 2z-1 +z-2) / (1 - 1.03z-1 +0.37z-2)

Q) Design butterworth filter using IIM with passband and stopband frequencies 200Hz and 500Hz respectively. The passband and stopband attenuation are -5dB and -12dB respectively. The sampling frequency is 5Hz.

```Given:
Higher cut off frequency (Fu) = 500Hz
Lower cut off frequency (Fl) = 200Hz```

Now,
fu = Fu / Fs = 500 / 5000 = 0.1
fl = Fl / Fs = 200 / 5000 = 0.04
So,
wp = 2πfl = 0.08π
ws = 2πfu = 0.2π

Similarly,
Ap = -5dB
As = -12dB

Now, follow steps 1 to 5 and finally use standard equations of Impulse invariant transformation to find H(z).

Q) The passband edge frequency is 0.25π and max deviation of 1dB below 0dB gain in passband. The max gain of -15dB and frequency is 0.45π in stopband. Consider sampling frequency of 1Hz.

```   wp = 0.25π
ws = 0.45π```

In pass band, below 0dB gain maximum deviation is 1dB. So,
Ap = 1dB
And,
As = 15dB

Q) The specifications are w<sub>p</sub> = 0.25π, w<sub>s</sub> = 0.55π, δ<sub>p</sub> = 0.11 and δ<sub>s</sub> = 0.21.

```   wp = 0.25π
ws = 0.55π
Now,
Ap = -20 log(1-δp) = 1.012dB
As = -20 log(δs) = 13.55dB
```

Q) A LPF with cut off frequency 0.2575π is given by H(z). Design a HPF with w<sub>c</sub>' = 0.3567π.

```The given low pass filter is:
H(z) = [0.1 + 0.4 z-1] / [1 - 0.6 z-1 + 0.1 z-2]
And,
wc = 0.2575π
wc' = 0.3567π```

Now,

To convert into high pass filter (HPF):
a = [ -cos {(wc + wc') /2} ] / [ cos {(wc - wc') /2} ]
a = - cos 0.3071π / cos (-0.0496π)
a = -0.5766

Then,
H'(z) = 0.1 + 0.4 [ {-z-1 - 0.5766} / {1 - 0.5766 z-1} ]