Вы находитесь на странице: 1из 42

Digital Filter Design

Realizable
Stable
Sharp Cutoff
Characteristics
Minimum order hence
lower complexity
Generalized procedure
Linear phase
characteristics
Implications of causality
Frequency response cant be zero except at finite number of
points. (Paley-Wiener theorem)

Transition from passband to stopband cant be infinitely


sharp. (Noncausal precursor in h(n))

The magnitude cant be constant over a finite range of


frequency (Gibbs Phenomenon due to truncation)

The real and imaginary parts of frequency response are


interdependent thus magnitude and phase response cant be
chosen arbitrarily.
Specifications of realizable filter

p - passband edge frequency


s - stopband edge frequency
p - peak ripple value in the passband
s - peak ripple value in the stopband
Analog to Digital domain Frequency
conversion Example
Example - Let Fp 7 kHz, Fs 3 kHz,
and FT 25 kHz
Then

2 (7 103 )
p 0.56
25 10 3

2 (3 103 )
s 0.24
25 10 3
IIR Vs FIR Filters
IIR Filters have lower sidelobes than FIR having same
parameters i.e. fewer parameters for same
performance hence IIR has lower computational
complexity.

IIR Causes phase distortion and limit cycles


IIR Digital Filter Design
Pole Placement method (Ch# 4)

Conversion method
(1) Convert the digital filter specifications into an analogue
prototype lowpass filter specifications H a (s)

(2) Determine the analogue lowpass filter transfer function


. (Butterworth, chebyshev, ellipltical, bessel etc methods)

(3) Transform H a (s) by replacing the complex variable to the


digital transfer function G (z )
Symmetric FIR filter has Linear Phase
Consider an FIR filter with impulse response h(n) of length
2M+1 and its transfer function as:
M
H z
n
z nh n
n M
z nh n

To make this filter causal, we need to shift the transfer


function by M samples in time domain by multiplying it with
z-M in z-domain M
H z zM
n M
z nh n

Frequency response of the filter is easily obtained using


substitution z=ej: M
H e j M
n M
e j n h n
If the coefficients are symmetrical around coefficient h(0), we can
write:
j M j n

M
H e h 0 h n e j n
e
n M
0 1<n<M instead
j M
M
e

h 0 0
n M
h n 2 cos n

zero phase term (i.e. pure real term)

Phase of this term is M, i.e. it is linear in

So filters with symmetrical impulse response (i.e. symmetrical


coefficients) have a linear phase.
Zeros of Linear Phase FIR Filters
M 1
H ( z) h
n o
( n ) z n

H ( z ) h(0) h(1) z 1 h(2) z 2 h( M 2) z ( M 2) h( M 1) z ( M 1)


sin ce for Linear phase we need
h(n) h( M 1 n) i.e.,
h(0) h( M 1); h(1) h( M 2);......h( M 1) h(0);
then
H ( z ) h( M 1) h( M 2) z 1 ........ h(1) z ( M 2) h(0) z ( M 1)
H ( z ) z ( M 1) [h( M 1) z ( M 1) h( M 2) z ( M 2) ..... h(1) z h(0)]
M 1
H ( z) z ( M 1)
[ h(n)( z 1 ) n ] z ( M 1) H ( z 1 )
n 0

( M 1) 1
H ( z) z H (z )

if z = z1 is a zero
then z=z1-1 is also
a zero
If h(n) has odd symmetry

If h(n)=-h(M-1-n) and M is odd, Hr() implies that


Hr(0)=0 & Hr()=0, consequently not suited for
lowpass and highpass filter.

Similarly if M is even Hr(0)=0 hence not used for low


pass filter

Hence antisymetric condition is not generally used


If h(n) has Even symmetry

Symmetry condition h(n)=h(M-1-n)


yields a linear-phase FIR filter with non zero
response at =0 if desired.
Methods of designing FIR filters

1. Fourier series based method


(rectangular windowing)

2. Window based method

3. Frequency sampling method, etc.


Example: Fourier Series Method
Prob: Design an ideal bandpass filter with a
frequency response:
3
H d (e j
) 1 for
4 4
0 otherwise
Find the values of h(n) for M = 11 and plot the
frequency response.
Hd(ejw)

1.0

- -3/4 -/4 /4 3/4



1
d
j j n
hd (n) H ( e ) e d
2
/ 4 3 / 4
1
e d e d
jn jn

2 3 / 4 /4
1 3
sin n sin n n
n 4 4
truncating to 11 samples we have h(n) hd (n) for | n | 5
0 otherwise
For n = 0 the value of h(n) is separately
evaluated from the basic integration
hd(0) = 0.5

Other values of h(n) are evaluated from h(n)


expression
hd (1)=hd (-1)=0
hd (2)=hd (-2)=-0.3183
hd (3)=hd (-3)=0
hd (4)=hd (-4)=0
hd (5)=hd (-5)=0
The transfer function of the filter is

( N 1) / 2
H ( z ) h ( 0) [ h
n 1
( n ){ z n
z n
}]

0.5 0.3183( z 2 z 2 )
the transfer function of the realizable filter is
H ' ( z ) z 5 [0.5 0.3183( z 2 z 2 )]
0.3183 z 3 0.5 z 5 0.3183 z 7
the filter coeff are
h(0) h(10) h(1) h(9) h( 2) h(8) h( 4) h(6) 0
h(3) h(7) 0.3183
h(5) 0.5
The magnitude response can be expressed as
( N 1) / 2
| H (e j
) | a(n) cos n
n 1

comparing this exp with


5
| H (e j ) || z 5 [h(0) 2 h(n) cos n] |
n 1

We have
a(0)=h(0)
a(1)=2h(1)=0
a(2)=2h(2)=-0.6366
a(3)=2h(3)=0
a(4)=2h(4)=0
a(5)=2h(5)=0
The magnitude response function is
|H(e j)| = 0.5 0.6366 cos 2 which can plotted for
various values of

in degrees =[0 20 30 45 60 75 90 105 120 135 150 160 180];

|H(e j)| in dBs= [-17.3 -38.17 -14.8 -6.02 -1.74 0.4346 1.11
0.4346 -1.74 -6.02 -14.8 -38.17 -17.3];
Example: Windowing Method
The arbitrary truncation of impulse response obtained
through inverse Fourier relation can lead to distortions in the
final frequency response.

The arbitrary truncation is equivalent to multiplying infinite


length function with finite length rectangular window, i.e.,
h(n) = hd(n) w(n) where w(n) = 1 for n = (M-1)/2

The above multiplication in time domain corresponds to


convolution in freq domain, i.e.,
H( e j ) = Hd(e j) * W(e j ) where W(e j ) is the FT of
window function w(n).
The FT of w(n) is given by
j sin( M / 2)
W (e )
sin( / 2)
Suppose the filter to be designed is Low pass filter then the
convolution of ideal filter freq response and window function
freq response results in distortion in the resultant filter freq
response. The ideal sharp cutoff chars are lost and
presence of ringing effect is seen at the band edges which
is referred to Gibbs Phenomena.

This is due to main lobe width and side lobes of the window
function freq response.

The main lobe width introduces transition band and side


lobes results in rippling characters in pass band and stop
band.

Smaller the main lobe width smaller will be the transition


band

The ripples will be of low amplitude if the peak of the first


side lobe is far below the main lobe peak.
How to reduce the distortions?

Increase length of the window

- as M increases the main lob width becomes narrower,


hence the transition band width is decreased

-With increase in length the side lobe width is decreased but


height of each side lobe increases in such a manner that the
area under each sidelobe remains invariant to changes in M.
Thus ripples and ringing effect in pass-band and stop-band
are not changed.

Choose windows which tapers off slowly rather than ending


abruptly

- Slow tapering reduces ringing and ripples but generally


increases transition width since main lobe width of these
kind of windows are larger.
What is ideal window characteristics?

Window having very small main lobe width with


most of the energy contained with it (i.e. ideal
window freq response must be impulsive)

Window design is a mathematical problem

More complex the window lesser are the distortions

Windows better than rectangular window are, Hamming,


Hanning, Blackman, Bartlett, Traingular,Kaiser
Rectangular window
wr (n) 1 for 0 n M 1
Hanning windows:
2n
whan (n) 0.5(1 cos ) for 0 n M 1
M 1
Hamming windows:
2n
wham (n) 0.54 0.46 cos for 0 n M 1
M 1
Blackman windows:
2n 4n
wblk (n) 0.42 0.5 cos 0.08 cos for 0 n M 1
M 1 M 1
Bartlett (Triangular) windows:
M 1
2|n |
wbart (n) 1 2 for 0 n M 1
M 1
Kaiser windows: 2


2
M 1 M 1
I0 n
2 2
wk (n) for 0 n M 1
M 1
I 0
2
Type of window Appr. Transition Peak sidelobe
width of the main (dB)
lobe

Rectangular 4/M -13


Bartlett 8/M -27

Hanning 8/M -32


Hamming 8/M -43
Blackman 12/M -58
Procedure for designing linear-phase FIR filters
using windows

1. From the desired freq response using inverse FT


relation obtain hd(n)
2. Truncate the infinite length of the impulse
response to finite length with ( assuming M odd)
choosing proper window
h(n) hd (n) w(n) where
w(n) is the window function defined for ( M 1) / 2 n ( M 1) / 2

3. Introduce h(n) = h(-n) for linear phase


characteristics
4. Write the expression for H(z); this is non-causal
realization
5. To obtain causal realization H(z) = z -(M-1)/2 H(z)
Prob: Design an ideal highpass filter with a frequency response:

H d ( e j ) 1 for
4

0 | |
4

using a hanning window with M = 11 and plot the frequency response.


Hd(ejw)

1.0

- -/4 /4
h(n)=[0 0 -0.026 -0.104 -0.204 0.75 -0.204 -0.104 -0.026 0 0]
H(e j) = 0.75 - 0.408cos - 0.208 cos2 - 0.052cos3

in degrees = [0 15 30 45 60 75 90 105 120 135 150 165 180]


|H(e j)| in dBs = [-21.72 -17.14 -10.67 -6.05 -3.07 -1.297 -0.3726
-0.0087 0.052 0.015 0 0 0.017]
Prob: Design a filter with a frequency response:


H d (e j ) e j 3 for
4 4

0 | |
4

using a Hanning window with M = 7

Soln:
The freq resp is having a term e j(M-1)/2 which gives h(n) symmetrical
about n = M-1/2 = 3 i.e we get a causal sequence.
/4
1
d
j 3 j n
hd ( n) e e
2 / 4


sin ( n 3)
4
( n 3)
this gives hd (0) hd (6) 0.075
hd (1) hd (5) 0.159
hd ( 2) hd ( 4) 0.22
hd (3) 0.25
The Hanning window function values are given by
whn(0) = whn(6) =0
whn(1)= whn(5) =0.25
whn(2)= whn(4) =0.75
whn(3)=1
h(n)=hd(n) whn(n)
h(n)=[0 0.03975 0.165 0.25 0.165 0.3975 0]

Вам также может понравиться