0% found this document useful (0 votes)
39 views21 pages

DSP Slide IV

Uploaded by

fegegbelulegn741
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views21 pages

DSP Slide IV

Uploaded by

fegegbelulegn741
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Digital Filter Design

▪ A filter is one in which rejects unwanted frequencies and allow the desired
frequencies.
▪ Based on the magnitude spectrum, filters are classified as lowpass, high
pass , band pass and band reject filters.

Ideal response curves


Steps of filter design
1. Specification of desired system properties(application driven)
2. Approximation of the specifications using discrete time systems
3. Realizations of system (technology driven: hardware/software)
Practical low pass filter specifications

In the passband:

In the stopband:
▪ In practice, we cannot implement filter characteristics with abrupt
transitions
E.g. the impulse response of ideal low pass filter is sinc(t), which is non-
causal.
▪ The problem of obtaining a realizable transfer function given the
specifications is approximation.

Butterworth , Chebyshev, Elliptical and Bessel response curves


Butterworth Approximation
1
𝐻(𝑗𝜔) 2 = 2𝑛
1+𝑐 2
𝜔 If 𝜔𝑝 =𝜔𝑐 , i.e 𝛼𝑝 =3dB ,then c=1
𝜔𝑝
1 1
𝐻(𝑗𝜔) 2 = 𝜔 2𝑛 put 𝜔𝑐 =1 𝐻(𝑗𝜔) 2 = Normalized ch-cs
1+ 1+ 𝜔 2𝑛
𝜔𝑐

2
As n gets larger 𝐻(𝑗𝜔) approaches
ideal LP

The order of the filter N is obtained as

αP Pass band attenuation in dB


αS Stop band attenuation in dB
ΩP Pass band frequency in rad/sec
ΩS Stop band frequency in rad/sec

To find cut off frequency


Digital filter
A digital filter is represented by its impulse response h(n).

The input and output signals are related by convolution sum

y(n)=σ∞
𝑘=0 ℎ 𝑘 𝑥(𝑛 − 𝑘) Infinite impulse response (IIR)

y(n)=σ𝑁−1
𝑘=0 ℎ 𝑘 𝑥(𝑛 − 𝑘) Finite impulse response (FIR)
𝑁−1

𝐻 𝑧 = ෍ ℎ(𝑘)𝑧 −𝑘 FIR transfer function Polynomial function


𝑘=0

σ𝑁
𝑘=0 𝑏𝑘 𝑧
−𝑘
𝐻 𝑧 = IIR transfer function Rational function
1 + σ𝑀
𝑘=1 𝑎𝑘 𝑧
−𝑘

E.g system described by 𝑦(𝑛) = 𝑥(𝑛) + 𝑥(𝑛 − 1), ℎ(𝑛) = {1,1} is FIR filter
and 𝑦 𝑛 = 𝑦 𝑛 − 1 + 𝑥 𝑛 , ℎ 𝑛 = 𝑢 𝑛 is IIR filter.
FIR IIR
▪ Polynomial system function ▪ Rational system function
▪ Zeros ▪ Poles + zeros
▪ Stable ▪Stable/unstable
▪ Easy to get linear phase ▪ Hard to control phase
▪High order (20 - 2000) ▪ Low order (4-20)
▪ Unrelated to analog filter ▪Designed on the basis of analog filter

FIR filter Design

The basic FIR filter is characterized by the following:

where, h(k); k=0,1,…, N-1 are the impulse response coefficients of the filter.
• Filter order= N-1.
• Filter Length= N
FIR filters can have an exactly linear phase response

For Symmetric linear phase filter : ℎ 𝑛 = ℎ 𝑁 − 1 − 𝑛 , 𝑛 = 0,1,2, … , 𝑁 − 1


𝑁−1 𝜔
The phase angle 𝜃 𝜔 = −
2
For antisymmetric linear phase filter : ℎ 𝑛 = −ℎ 𝑁 − 1 − 𝑛 , 𝑛 = 0,1,2, … , 𝑁 − 1
𝜋 𝑁−1 𝜔
The phase angle 𝜃 𝜔 = − −
2 2

For symmetric and anti symmetric FIR filters; the condition for linear phase is

ℎ 𝑛 = ±ℎ 𝑁 − 1 − 𝑛 , 𝑛 = 0,1,2, … , 𝑁 − 1

Steps to design FIR filter


i. Choose the desired (ideal) frequency response 𝐻𝑑 𝜔
ii. Get ℎ𝑑 𝑛 𝑖. 𝑒 𝐼𝐷𝑇𝐹𝑇 𝑜𝑓 𝐻𝑑 𝜔
iii. Convert the infinite duration sequence ℎ𝑑 𝑛 to get finite duration sequence h(n)
iv. Take z-transform of h(n) to get the transfer function H(z) of the FIR filter.

Well known FIR design methods for linear phase

1. Window method
2. Frequency sampling method
3. Optimal filter design method

Design of FIR filters using windows

✓ Straight forward to obtain h(n) with minimal computational effort.


Design steps:

Step 1. For the desired frequency response 𝐻𝑑 𝜔 find ℎ𝑑 𝑛 using


𝜋
1
ℎ𝑑 𝑛 = න 𝐻𝑑 𝜔 𝑒 𝑗𝜔𝑛 𝑑𝜔
2𝜋
−𝜋

Step 2. Multiply the infinite impulse response ℎ𝑑 𝑛 with a chosen


window sequence 𝜔 𝑛 of length N to obtain filter coefficients h(n) i.e.
𝑁−1 𝑁−1
ℎ𝑑 𝑛 𝜔 𝑛 𝑓𝑜𝑟 𝑛 = 0,1, … , 𝑁 − 1 𝑜𝑟 − ≤𝑛≤
ℎ 𝑛 =൞ 2 2
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Step3 Find the transfer function of the realizable filters
Case I. if 𝜔(𝑛) is given for n=0,1,…,N-1,then h(n)=h(0),h(1),…,N-1 are the filter
coefficients
𝑁−1 𝑁−1
Case II. If 𝜔(𝑛) is given for − ≤𝑛≤ ,then first find the
2 2
transfer function of the realizable filter
𝑁−1
−( )
𝐻 𝑧 =𝑧 2 [ℎ 0 + σ𝑁−1
𝑛=1 ℎ(𝑛)(𝑧
−𝑛
+ 𝑧 𝑛 )]

Name of window Function 𝜔 𝑛 , 0 ≤ 𝑛 ≤ 𝑁


Rectangular 1
Hanning 2𝜋𝑛
0.5 − 0.5cos( )
𝑁

Hamming 2𝜋𝑛
0.5 − 0.5cos( )
𝑁

Some window(weighting) functions


Eg.1 Design FIR low pass filter using rectangular window with passband gain
of unity ,cut off frequency of 200Hz,sampling frequency of 1KHz.Assume the
length of impulse response is 7.

solution 𝑓𝑐 = 200𝐻𝑧, 𝑓𝑠 = 1000𝐻𝑧 𝑎𝑛𝑑 𝑁 = 7


2𝜋𝑓𝑐 2𝜋
Normalized cutoff frequency 𝜔𝑐 = = 𝑟𝑎𝑑/𝑠𝑒𝑐
𝑓𝑠 5
−2𝜋 2𝜋
1 , ≤𝜔≤
𝐻𝑑 𝜔 = 5 5
−2𝜋 2𝜋
0, −𝜋 < 𝜔 < 𝑎𝑛𝑑 <𝜔<𝜋
5 5
𝑁−1 𝜔
−𝑗
Note : If it were required to have linear phase , 1 → 𝑒 2

2𝜋
𝜋 5 2𝜋𝑛
1 1 𝑠𝑖𝑛
ℎ𝑑 𝑛 = න 𝐻𝑑 𝜔 𝑒 −𝑗𝜔𝑛 𝑑𝜔 = න 1𝑒 −𝑗𝜔𝑛 𝑑𝜔 = 5
2𝜋 2𝜋 𝜋𝑛
−𝜋 2𝜋
−5
2𝜋
5
1 0
1 2𝜋
ℎ𝑑 0 = න 1. 𝑒 𝑑𝜔 = 2 = 0.4
2𝜋 2𝜋 5
−2𝜋
5
2𝜋
𝑠𝑖𝑛 𝑛 1, 0,1, … , 6
5 ,𝑛 ≠ 0 Take 𝑊𝑅 𝑛 = ቊ
∴ ℎ𝑑 𝑛 = 0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
𝜋𝑛
0. 4 ,𝑛 = 0

ℎ𝑑 𝑛 , 𝑛 = 0,1, … , 6
ℎ 𝑛 =ቊ
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

2𝜋 2𝜋
sin 1 sin 2
5 5
ℎ 1 = = 0.302 ℎ 2 = = 0.093
𝜋(1) 𝜋(2)
2𝜋 2𝜋
sin 3 sin 4
5 5
ℎ 3 = = −0.062 ℎ 4 = = −0.075
𝜋(3) 𝜋(4)
2𝜋
sin 6
5
ℎ 6 = = 0.05
𝜋(6)

ℎ 𝑛 = { 0.4, 0.32 , 0.093 , −0.062 , −0.075 , 0, 0.05 }


IIR filter Design

❖ The popular methods of IIR filter design uses the technique of first designing in
analog domain and then transforming the analog filter into an equivalent digital IIR
filter .
Why Transform to Analog IIR Filter Design?
▪ Analog approximation techniques are highly advanced
▪ Many analog filter design methods have relatively closed-form design formulas.
▪ Extensive tables are available for analog filter design
Transformation Techniques
1. A set of specs for the digital (discrete-time) filter is given.
2. Transform the specs from the D.T. to C.T. (z → s)
3. Design a C.T. IIR filter : H (s )
a
4. s → z H a (s) → H ( z )

Desirable Properties of Transformations

1. Causal/stable analog filter should be transformed to a causal stable DT filter.


H a (s) → H ( z )

Causal and stable Causal and stable

2. jΏ axis in the s-plane (CT) needs to be transformed to the unit circle in the z-
domain.

3. LHP in the s-domain is mapped into inside the unit circle in the z-domain.
Analog to Digital filter transformation methods

Approximation of Derivatives
Impulse Invariance transformation
✓Bilinear Transformation(best)

Bilinear Transformation
▪ The bilinear transformation yields stable digital filters from stable analogue
filters
▪ Bilinear transformation avoids the problem of aliasing encountered with the use
of the impulse invariant transformation, because it maps the entire imaginary axis
in the s-plane on to the unit circle in the z-plane.
2
𝑠𝑇 𝑠𝑇 1 𝑠𝑇 𝑠𝑇
𝑒2 1+ + +⋯ 1+
𝑧 = 𝑒 𝑠𝑇 = = 2 2! 2 ≅ 2
−𝑠𝑇
𝑠𝑇 1 𝑠𝑇 2 𝑠𝑇
𝑒 2 1− + +⋯ 1 −
2 2! 2 2

2 𝑧−1
∴ 𝑠=
𝑇 𝑧+1
2 𝑟𝑒 𝑗𝜔 −1 2 𝑟𝑒 𝑗𝜔 −1 𝑟𝑒 𝑗𝜔 +1
𝑝𝑢𝑡 𝑧 = 𝑟𝑒 𝑗𝜔 𝑠 = =
𝑇 𝑟𝑒 𝑗𝜔 +1 𝑇 𝑟𝑒 𝑗𝜔 +1 𝑟𝑒 𝑗𝜔 +1
2 𝑟 2 −1 2𝑟𝑠𝑖𝑛𝜔
= + 𝑗 Since 𝑠 = 𝜎 + 𝑗Ω
𝑇 1+𝑟 2 +2𝑟𝑐𝑜𝑠𝜔 1+𝑟 2 +2𝑟𝑐𝑜𝑠𝜔

2 𝑟 2 −1 2 2𝑟𝑠𝑖𝑛𝜔
𝜎= ,Ω = ( )
𝑇 1+𝑟 2 +2𝑟𝑐𝑜𝑠𝜔 𝑇 1+𝑟 2 +2𝑟𝑐𝑜𝑠𝜔

Observation

If r < 1 then σ < 0 and if r > 1, then σ >


0, and if r = 1, then σ = 0 .
The left half of the s-plane maps into points inside the unit circle in the z-plane,
the right half of the s-plane maps into points outside the unit circle in the z-plane
and the imaginary axis of s-plane maps into the unit circle in the z-plane.
Relation between analog and digital frequencies
On the imaginary axis of s-plane σ = 0 and correspondingly in the z-plane r = 1.
−𝑗𝜔 𝑗𝜔 𝑗𝜔
𝑗2 𝑗2
2 𝑒 𝑗𝜔
−1 2 −1𝑒 𝑗𝜔 𝑒 2 2 𝑒 − 𝑒
𝑝𝑢𝑡 𝑧 = 𝑒 𝑗𝜔 Ω = = =
𝑇 𝑒 𝑗𝜔 + 1 𝑇 𝑒 𝑗𝜔 + 1 −𝑗𝜔 𝑇 𝑗
𝑗𝜔
𝑗
𝑗𝜔
𝑒 2 𝑒 2 +𝑒 2
2 𝜔
Ω = tan Disc. to Cont. Freq. mapping
𝑇 2
which is a nonlinear frequency warping
−∞ < Ω < ∞ ↔ −𝜋 ≤ 𝜔 ≤ 𝜋

Eg.1 Obtain H(z) from Ha(s) when T = 1sec and

3𝑠
𝐻𝑎 𝑠 =
𝑠 2 +0.5𝑠+2

using the bilinear transformation.


2 𝑧−1 in 𝐻𝑎 (𝑠).
Solution: To get H(z) using the bilinear transformation, put 𝑠=
𝑇 𝑧+1
Eg.2 A digital filter with a 3dB bandwidth of 0.4𝜋 is to be designed from the
analog filter whose system response is:
3𝑠
𝐻𝑎 𝑠 =
𝑠 2 +0.5𝑠+2

Use the bilinear transformation and obtain H(z).


2 𝜔𝑐 the 3dB bandwidth 𝜔𝑐 = 0.4𝜋
Solution: Ω𝑐 = tan( )
𝑇 2

The system response of the digital filter is given by

Bilinear Transformation Design Procedure

1. Convert given specification in digital domain into analog filter specification


(prewarping) using 2 𝜔
Ω= tan
𝑇 2
i.e prewarp critical band-edge frequencies (ωp and ωs) to analog frequencies (Ωp and Ωs)
2. Design analog filter (Butterworth ,Chebyshev elliptic):𝐻 s using
prewarped critical frequencies.

3. Apply bilinear transform to get H(z) out of H(s)


Eg.1 Using the bilinear transformation, design a high pass filter, monotonic in pass
band with cut off frequency of 1000Hz and down 10dB at 350 Hz. The sampling
frequency is 5000Hz.
1 1
Solution: Given Pass band attenuation 𝛼𝑝 = 3𝑑𝐵 𝑇= = = 2 ∗ 10−4 𝑠𝑒𝑐
𝑓𝑠 5000
Stop band attenuation 𝛼𝑠 = 10𝑑𝐵

2𝜋𝑓𝑐 1000 2𝜋𝑓𝑠𝑡𝑜𝑝 350


𝜔𝑝 = 𝜔𝑐 = = 2𝜋 ∗ = 0.4𝜋 𝜔𝑠 = = 2𝜋 ∗ = 0.14𝜋
𝑓𝑠 5000 𝑓𝑠 5000

Prewarping the digital frequencies


2 𝜔𝑐
Ω𝑐 = tan = 104 tan 0.2𝜋 = 7265rad/sec
𝑇 2
2 𝜔𝑐
Ω𝑝 = tan = 104 tan 0.07𝜋 = 2235rad/sec
𝑇 2
The order of the filter

1
Normalized 1st order Butterworth filter H s =
s+1

The high pass filter for ΩC=ΩP=7265 rad/sec can be obtained by using the
transformation

The transfer function of high pass filter

Using bilinear transformation


Exercise Design a low-pass Butterworth filter using the bilinear transformation
method for satisfying the following constraints:
Passband: 0–400 Hz
Stopband: 2.1–4 kHz
Passband ripple: 2 dB
Stopband attenuation: 20 dB
Sampling frequency: 10 kHz

You might also like