Anda di halaman 1dari 0

Curtin University, Australia 5-1

YH Leung (2005, 2006, 2007, 2008, 2012)


DESIGN OF FIR FILTERS


1 Filter Structures

Recall LCCDE of a causal Mth order non-recursive filter (assuming
0
1 a = )

0
[ ] [ ]
M
k
k
y n b x n k
=
= -

(1)
and its impulse response
{ }
=
=
0 1
0
[ ] , , ,
M
M
n
h n b b b (2)


It follows we can write

0
[ ] [ ] [ ]
M
k
y n h k x n k
=
= -

(3)
which has corresponding transfer function

-
=
=

0
( ) [ ]
M
k
k
H z h k z (4)


Clearly, non-recursive filter of Eq. (4) describes an FIR filter. This FIR filter is
said to have order M, or length 1 M +



A block diagram representation of Eq. (3) shown below

Fig. 1 Direct form realisation of a non-recursive filter

Structure shown above called direct form it implements Eq. (3) directly, and
corresponding FIR filter is said to have 1 M + taps
1
z
-

x[n]
y[n]
[0] h [1] h [ ] h M
1
z
- 1
z
-
Curtin University, Australia 5-2
YH Leung (2005, 2006, 2007, 2008, 2012)
Consider next following block diagram

Fig. 2 Transposed form realisation of a non-recursive filter

Structure shown above called transposed form derived by applying
transposition theorem
1
on direct form structure of Fig. 1



Now,
1
[ ] [0] [ ] [ 1] y n h x n v n = + - (5)

1 2
[ ] [1] [ ] [ 1] v n h x n v n = + - (6)


1
[ ] [ 1] [ ] [ 1]
M M
v n h M x n v n
-
= - + - (7)
[ ] [ ] [ ]
M
v n h M x n = (8)

Substituting Eq. (8) into Eq. (7), then Eq. (7) into the previous equation, etc.,
we get
{ } { } { } = + - + - + + - [ ] [0] [ ] [1] [ 1] [2] [ 2] [ ] [ ] y n h x n h x n h x n h M x n M (9)
which is same as Eq. (3)



Thus, direct and transposed forms are identical algebraically. Main difference is
in pros and cons they each offer in implementation


1
See A. V. Oppenheim and R. W. Schafer, Discrete-Time Signal Processing, 3rd ed., Prentice-Hall,
2010, Section 6.4, pp. 425-429
x[n]
1
z
- 1
z
- 1
z
-
[ ] h M
y[n]

[ 1] h M - [1] h [0] h
1
[ ]
M
v n
- 1
[ ] v n [ ]
M
v n
Curtin University, Australia 5-3
YH Leung (2005, 2006, 2007, 2008, 2012)
Recall impulse response of a linear phase FIR filter satisfies
[ ] [ ], 0 h n h M n n M = - (Types I and II) (10)
[ ] [ ], 0 h n h M n n M = - - (Types III and IV) (11)



Eq. (10) suggests following more efficient (multiplier-saving) direct form
structure of a Type I linear phase FIR filter

Fig. 3 Efficient structure for a Type I linear phase FIR filter



Exercise. Obtain similar wrap-around direct form structures for the Type II,
III and IV linear phase FIR filters



Exercise. Can transposed form be made more efficient for linear phase FIR
filters?



Further discussion on implementation issues is beyond scope of present course

y[n]
[0] h
1
z
- 1
z
- 1
z
- 1
z
-
1
z
- 1
z
- 1
z
- 1
z
-

[1] h
2
[ 1]
M
h -
2
[ ]
M
h
x[n]
Curtin University, Australia 5-4
YH Leung (2005, 2006, 2007, 2008, 2012)
We reiterate: non-recursive filters must be FIR, but FIR filters need not be
non-recursive
But beware! The terms non-recursive filters and FIR filters are often used
interchangeably



Example of a recursive FIR filter is the Hogenauer filter
Consider recursive LCCDE
[ ] [ 1] [ ] [ ( 1)] y n y n x n x n M = - + - - + (12)
which has corresponding transfer function

( 1)
1
1
( )
1
M
z
H z
z
- +
-
-
=
-
(13)
Fig. 4 gives block diagram representation of Eq. (12) which clearly shows its
recursive nature

Fig. 4 The Hogenauer filter



But
( 1)
1
1
1
( ) 1
1
M
M
z
H z z z
z
- +
- -
-
-
= = + + +
-
(14)
Therefore, Hogenauer filter has finite length impulse response { }
=

0
1, 1, , 1
M
n




Hogenauer filter can be considered to be a special form of the difference
routing digital filter (DRDF)
DRDFs are discussed in Appendix I
1
z
-

x[n]
y[n]
1
z
- 1
z
-
x[n-(M+1)]
1
z
-
Curtin University, Australia 5-5
YH Leung (2005, 2006, 2007, 2008, 2012)
2 Design Methods

FIR filters always stable, whereas IIR filters may or may not be stable
great interest in the design and efficient implementation of FIR filters



FIR filters can also be easily made linear phase (through symmetry in impulse
response)
design methods invariably geared towards design of linear phase filters



Recall, for linear phase FIR filters
Type II
II
( ) 0
j
H e
p
= (15)
Type III
0
III III
( ) ( ) 0
j j
H e H e
p
= = (16)
Type IV
0
IV
( ) 0
j
H e = (17)
Above constraints lead to following design restriction matrix

Lowpass Highpass Bandstop Bandpass
Type I
Type II
Type III
Type IV
Table 1 Suitability of filters types



There are 3 main design methods:
(i) Window method
(ii) Frequency sampling method
(iii) Optimisation method

We shall study window and optimisation methods in this course
Frequency sampling method is discussed in Appendix II
Curtin University, Australia 5-6
YH Leung (2005, 2006, 2007, 2008, 2012)
3 Window Method

3.1 Some Basic Ideas

Consider following design specification

Fig. 5 Design specification of a lowpass filter

Also shown is an ideal desired magnitude response
q
( )
j
d
H e which clearly
meets specification



Suppose
q
aq

=-


arg ( )
j
d
H e . Impulse response of ideal filter is given by

q a
p a
-
=
-
sin ( )
[ ]
( )
c
d
n
h n
n
(18)



[ ]
d
h n has support n -< < . To obtain a FIR filter with finite length
impulse response [ ] h n , one simply truncates [ ]
d
h n
But there are 3 considerations:
(i) For causality and FIR, we retain only samples of [ ]
d
h n for 0 n M
where M is some finite integer
(ii) For phase linearity, we require retained samples to be symmetrical (or
anti-symmetrical) about mid-point of sequence. This implies 2 M a =
in Eq. (18)
(iii) To meet design specification, intuitively, there will be a minimum M that
we can choose
d
2
d -
1
1
d +
1
1
q
( )
j
H e
0
q
p
q
s
q
p
( )
1
2
( ) ,
j
d c p s
H e
q
q q q = +
c
q
Curtin University, Australia 5-7
YH Leung (2005, 2006, 2007, 2008, 2012)
Why want M small?
Lower complexity lower cost, lower power consumption
Smaller group delay



Truncating [ ]
d
h n equivalent to multiplying it with a rectangular window (See
Fig. 6)
= [ ] [ ] [ ]
d
h n h n w n (19)
where
1, 0
[ ]
0, otherwise
n M
w n

(20)
Above procedure is basic idea of window method



In frequency domain, Eq. (19) yields the convolution

p
q q q x q x
p
x
p
-
-
= * =

( )
1
( ) ( ) ( ) ( ) ( )
2
j j j j j
d d
H e H e W e H e W e d (21)
where { }
( )
( )
2
sin ( 1) 2
( ) DTFT [ ]
sin 2
j j M
M
W e w n e
q q
q
q
-
+
= = (22)



Effect of windowing is to smear ideal frequency response ( )
j
d
H e
q


Fig. 6 Frequency smearing effect of windowing
5 0 5 10 15 20 25
0.1
0
0.1
0.2
0.3
h
d
[n]
5 0 5 10 15 20 25
0
0.5
1
w[n]
5 0 5 10 15 20 25
0.1
0
0.1
0.2
0.3
n
h[n]
1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
0
0.5
1
|H
d
(e
j
)|
1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
0
5
10
15
20
|W(e
j
)|
1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
0
0.5
1
(x)
|H(e
j
)|
Curtin University, Australia 5-8
YH Leung (2005, 2006, 2007, 2008, 2012)
Frequency smearing can be minimised by making ( )
j
W e
q
thin but from Eq.
(22), this implies a large M not good



Summarising, we find smallest M such that ( )
j
W e
q
just thin enough for ( )
j
H e
q

to meet design specification

BUT




3.2 A Closer Look

Recall Eq. (21)

( )
1
( ) ( ) ( )
2
j j j
d
H e H e W e d
p
q x q x
p
x
p
-
-
=


where, in general,

2
( ) ( )
j j j M
d d
H e A e e
q q q -
= , ( )
j
d
A e
q
real and even (23)
and
q q q -
=
2
( ) ( )
j j j M
a
W e W e e ,
q
( )
j
a
W e real and even (24)



It follows that

p
q x x q x q x
p
x
p
- - - -
-
=

2 ( ) ( ) 2
1
( ) ( ) ( )
2
j j j M j j M
d a
H e A e e W e e d

p
x q x q q
p
x
p
- -
-



=


( ) 2
1
( ) ( )
2
( )
j j j
a
j M
d
A e W e d e H e (25)

Define the real even function

p
q x q x
p
x
p
-
-
=

( )
1
( ) ( ) ( )
2
j j j
d a
A e A e W e d (26)

Curtin University, Australia 5-9
YH Leung (2005, 2006, 2007, 2008, 2012)

( )
1
( ) ( ) ( )
2
j j j
d a
A e A e W e d
p
q x q x
p
x
p
-
-
=



Figure below illustrates evaluation of Eq. (26) for 3 values of q

1, 0.3 0.3
( )
0, otherwise
j
d
A e
q
p q p

- < <

(27)
and
( )
( )
q
q
q
+
= =
sin ( 1) 2
( ) , 39
sin 2
j
a
M
W e M (28)

Fig. 7 Evaluation of
q
( )
j
A e for three different q and 39 M = rectangular window



(i) width of transition region determined mainly by main-lobe width of
( )
j
W e
q

(ii) ripple in passband or stopband (i.e. in-band response) depends mainly
on side-lobe structure of ( )
j
W e
q


1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
0
0.5
1
(x)
|H(e
j
)|
1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
0
0.5
1
<
c

1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
0
0.5
1
=
c

1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
0
0.5
1
>
c

(x)
Curtin University, Australia 5-10
YH Leung (2005, 2006, 2007, 2008, 2012)
Figure below defines main-lobe width
ml
D and peak side-lobe level
sl
A of
a window function

Fig. 8 Definition of main lobe width and peak side lobe



Can readily show from Eq. (22) that for rectangular windows (exercise!)

ml
4
1 M
p
D =
+
and
0
( ) 1
j
W e M = + (29)



To find
sl
A , we differentiate Eq. (22) to get a non-linear equation. Solving this
numerically yields following figure

Fig. 9 Peak side-lobe level relative to level of mean-lobe peak
1 0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
1.2
mainlobe width

ml
peak sidelobe level
A
sl
(x)
|
W
(
e
j

)
/
W
(
e
j
0
)
|
0 5 10 15 20 25 30 35 40
13.5
13
12.5
12
11.5
11
10.5
10
9.5
M
A
s
l



(
d
B
)
Curtin University, Australia 5-11
YH Leung (2005, 2006, 2007, 2008, 2012)
Eq. (29) shows, by choosing M sufficiently large, one can fit transition band
of ( )
j
H e
q
inside design mask no matter how tight it may be
However, Fig. 9 reveals a fundamental problem maximum ripple of
q
( )
j
H e
in its passband and stopband almost independent of M
2




Above quandary has led many researchers to investigate other window
functions
Basically, they aim to trade-off
ml
D for a lower
sl
A


2
A solution is to push as many peak side-lobes of ( )
j
W e
q
as necessary into the transition region by
keep on increasing M . But this will require a significant increase in M . See Fig. 11
Curtin University, Australia 5-12
YH Leung (2005, 2006, 2007, 2008, 2012)
3.3 The Window Method

Many window functions have been proposed (see MATLAB for a partial, but
nonetheless substantial, list). Five most common ones are listed below

Rectangular

1, 0
[ ]
0, otherwise
n M
w n

(30)

Bartlett (triangular)

2 , 0 2
[ ] 2 2 , 2
0, otherwise
n M n M
w n n M M n M

= -

(31)

Hanning

0.5 0.5cos(2 ), 0
[ ]
0, otherwise
n M n M
w n
p

(32)

Hamming

0.54 0.46cos(2 ), 0
[ ]
0, otherwise
n M n M
w n
p

(33)

Blackman

0.42 0.5cos(2 ) 0.08cos(4 ), 0
[ ]
0, otherwise
n M n M n M
w n
p p

- +

(34)

Fig. 10 Five commonly used windows
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.2
0.4
0.6
0.8
1
1.2
n/M
w[n]


Rectangular
Bartlett
Hanning
Hamming
Blackman
Curtin University, Australia 5-13
YH Leung (2005, 2006, 2007, 2008, 2012)
Log magnitude responses of the windows for 50 M = and 200 are plotted
below



Fig. 11 Log magnitude response of windows for 50 M = and 200



(i) Window shape controls main-lobe and side-lobe behaviour
(ii) Window length controls main-lobe behaviour only
3


3
Unless we are prepared to go down the objectionable path as suggested in Footnote 2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
100
80
60
40
20
0
(x)
2
0

l
o
g
|
W
(
e
j

)
/
W
(
e
j
0
)
|
Rectangular window


M = 50
M=200
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
100
80
60
40
20
0
(x)
2
0

l
o
g
|
W
(
e
j

)
/
W
(
e
j
0
)
|
Bartlett window


M = 50
M=200
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
100
80
60
40
20
0
(x)
2
0

l
o
g
|
W
(
e
j

)
/
W
(
e
j
0
)
|
Hanning window


M = 50
M=200
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
100
80
60
40
20
0
(x)
2
0

l
o
g
|
W
(
e
j

)
/
W
(
e
j
0
)
|
Hamming window


M = 50
M=200
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
100
80
60
40
20
0
(x)
2
0

l
o
g
|
W
(
e
j

)
/
W
(
e
j
0
)
|
Blackman window


M = 50
M=200
Curtin University, Australia 5-14
YH Leung (2005, 2006, 2007, 2008, 2012)
Above observation means filter design should proceed as follows:
(i) From in-band requirements, choose window shape [ ] w n
(ii) From transition width requirement, choose window length parameter M
(recall window length is 1 M + )
(iii) From design specification, determine ideal desired frequency response
and ideal impulse response [ ]
d
h n . Centre [ ]
d
h n at 2 n M =
(iv) Window [ ]
d
h n by [ ] w n , i.e. [ ] [ ] [ ]
d
h n w n h n =



Main properties of five commonly used windows are summarised below

Window
Peak Side-lobe
Amplitude
sl
A
(Relative to
Main-lobe Peak)
Approximate
Main-lobe Width
ml
D
Peak
Approximation
Error, 20logd
Rectangular 13 dB 4 ( 1) M p +
21 dB
Bartlett 25 dB 8 M p
25 dB
Hanning 31 dB 8 M p
44 dB
Hamming 41 dB 8 M p
53 dB
Blackman 57 dB 12 M p
74 dB
Table 2 Properties of five commonly used windows



4th column of Table 2 derived as follows
With reference to Fig. 7, we see integral below is of interest

q
q x
p
x
p
-
=

1
( ) ( )
2
j j
a
U e W e d (35)
and in particular, we are interested in determining its peak overshoot d
4

Figure next page plots ( )
j
U e
q
for a 20 M = rectangular window


4
Peak undershoot of ( )
j
U e
q
equals its peak overshoot because of symmetry in ( )
j
U e
q

Curtin University, Australia 5-15
YH Leung (2005, 2006, 2007, 2008, 2012)

Fig. 12 Plot of
q
( )
j
a
W e and its integral for an 20 M = rectangular window


Peak overshoot occurs when ( ) 0
j
d
d
U e
q
q
= at a q just greater than 0 q =
But
q q
q
= ( ) ( )
j j
d
a
d
U e W e . Therefore, peak overshoot occurs when ( ) 0
j
a
W e
q
= ,
i.e. at
ml
2 q =D , whereupon, d
D
=
ml
2
( )
j
U e



[ ]
d
h n ? Previously, we have considered following ideal magnitude responses

Fig. 13 Ideal magnitude responses of lowpass, highpass, bandstop and bandpass filters



Suppose filter length has been determined to be ( 1) M +
1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
5
0
5
10
15
20
25
(x)
W
a
(
e
j

)
Rectangular window
1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
0
0.5
1
(x)
I
n
t
e
g
r
a
l

o
f

W
a
(
e
j

)
0
q
lp
( )
j
H e
q
c
q p
1
0
q
hp
( )
j
H e
q
c
q p
1
0
q
bs
( )
j
H e
q
b
q p
1
a
q 0
q
bp
( )
j
H e
q
b
q p
1
a
q
lowpass
bandstop
highpass
bandpass
d
Curtin University, Australia 5-16
YH Leung (2005, 2006, 2007, 2008, 2012)
Consider following ideal frequency response

q q q
p q p
-
= -
2
( ) ( ) ,
j j j M
d d
H e H e e (36)
where d denotes lp, hp, bs or bp. It can be shown that

( )
2
2
sin ( )
lp
( )
[ ]
M
c
M
n
n
h n
q
p
-
-
= (37)

( ) ( )
2 2
2 2
sin ( ) sin ( )
hp
( ) ( )
[ ]
M M
c
M M
n n
n n
h n
p q
p p
- -
- -
= - (38)

( ) ( ) ( )
2 2 2
2 2 2
sin ( ) sin ( ) sin ( )
bs
( ) ( ) ( )
[ ]
M M M
a b
M M M
n n n
n n n
h n
q p q
p p p
- - -
- - -
= + - (39)
and
( ) ( )
2 2
2 2
sin ( ) sin ( )
bp
( ) ( )
[ ]
M M
b a
M M
n n
n n
h n
q q
p p
- -
- -
= - (40)
Above impulse response sequences are symmetrical about
2
M
n =
Type I and Type II filters


Consider next following ideal frequency response

q q q
q p q p
-
= - -
2
( ) sgn( ) ( ) ,
j j j M
d d
H e j H e e (41)
where d denotes lp, hp, bs or bp. It can be shown that

( )
2
2 2
2
2sin ( )
lp
( )
[ ]
c M
M
n
n
h n
q
p
-
-
= (42)

( )
( )
2
2
2 2
2 2
2 2
2sin ( )
2sin ( )
hp
( ) ( )
[ ]
c M
M
M M
n
n
n n
h n
q
p
p p
-
-
- -
= - (43)

( )
( )
( )
2 2
2
2 2 2 2
2 2
2 2 2
2sin ( ) 2sin ( )
2sin ( )
bs
( ) ( ) ( )
[ ]
a b M M
M
M M M
n n
n
n n n
h n
q q
p
p p p
- -
-
- - -
= + - (44)
and
( ) ( )
2 2
2 2 2 2
2 2
2sin ( ) 2sin ( )
bp
( ) ( )
[ ]
b a M M
M M
n n
n n
h n
q q
p p
- -
- -
= - (45)
Above impulse response sequences are anti-symmetrical about
2
M
n =
Type III and Type IV filters
5


5
Strictly, by the design matrix of pp. 5, Type III filters can only be bandpass while Type IV filters can
only be highpass or bandpass
Curtin University, Australia 5-17
YH Leung (2005, 2006, 2007, 2008, 2012)
Example 1
Consider following lowpass design specification with
1
0.05 d = ,
2
0.1 d = , 0.25
p
q p = and 0.45
s
q p =

Fig. 5 Design specification of a lowpass filter

From in-band specification, tightest tolerance occurs in passband, i.e.

1
20log 26.0206 dB d = -
From Table 2 column 4, we see only Hanning, Hamming, and Blackman windows are suitable.
Suppose we choose Hanning. Transition width is 0.45 0.25 0.2
s p
q q p p p - = - = . So we require a
main lobe width of about 0.2p
6
. From Table 2 column 3, we get for Hanning window

ml
8 8 0.2 40 M p p p = D = =
Therefore,
0.5 0.5cos( 20), 0 40
[ ]
0, otherwise
n n
w n
p



Now, ideal filter has impulse response (assuming Type I/II filter)

( )
2
2
sin ( ) sin 0.35 ( 20)
[ ] ,
( 20) ( )
M
c
d
M
n n
h n n
n n
q p
p p
- -
= = - < <
- -

Multiplying [ ]
d
h n with [ ] w n , we obtain impulse response sequence and corresponding magnitude
response shown below


6
Actually, main-lobe width can be chosen to be larger than the transition width. See A. V. Oppenheim and R. W. Schafer,
Discrete-Time Signal Processing, 3rd ed., Prentice-Hall, 2010, Example 7.7, pp. 569-570
d
2
d -
1
1
d +
1
1
q
( )
j
H e
0
q
p
q
s
q
p
( )
1
2
( ) ,
j
d c p s
H e
q
q q q = +
c
q
0 5 10 15 20 25 30 35 40
0.1
0
0.1
0.2
0.3
0.4
n
h
[
n
]
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
(x)
|
H
(
e
j

)
|
Curtin University, Australia 5-18
YH Leung (2005, 2006, 2007, 2008, 2012)
In above example, we have clearly over-designed, i.e. chosen M too large
Reason: We have set main-lobe width too conservatively see Footnote 6



Example 1 (cont.)
By trial and error, it turns out M can be reduced to 26. This corresponds to
ml
8 M p D = =
8 26 0.3077 p p =

Moreover, since d d >
2 1
, we can move q
c
closer to q
s
. Again, by trial and error, it was found choosing
q p = 0.36
c
will reduce M further to 22




Window design method as described not satisfactory involves too much trial
and error on M and ideal cut-off frequencies, and on choice of window
Kaiser developed a more systematic method

0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
(x)
|
H
(
e
j

)
|


M=40,
c
=0.35
M=26,
c
=0.35
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
(x)
|
H
(
e
j

)
|


M=26,
c
=0.35
M=22,
c
=0.36
Curtin University, Australia 5-19
YH Leung (2005, 2006, 2007, 2008, 2012)
But before discussing Kaiser window method, worthwhile to re-examine
procedure used to determine d from design specifications
(i) We chose Hanning window because its peak approximation error, as given by
column 4 of Table 2, is less than the specified in-band tolerances
(ii) However, entries of Table 2 were derived by examining the main-lobe and side-
lobe behaviour of the DTFT of only one window function
(iii) A lowpass filter actually involves two window functions (or rather, their integrals
see Fig. 7 and Fig. 12) as shown below

Fig. 14 Interaction of window functions in passband and stopband
(iv) Side lobes of both window functions interact, through their integrals, in
passband and stopband
(v) A conservative approach is to assume largest side-lobe peaks of both window
integrals add constructively in one of or both in-band regions. We thus require
peak approximation error d of our choice of window to equal or be less than
d
1
and d
2
. But this will restrict our choice of windows greatly
(vi) On the other extreme, we observe side-lobe activities are strongest near the
main lobe (see Fig. 11 and Fig. 12) and tend to decrease rather rapidly as
we move away from the main lobe. Therefore, if main lobes are sufficiently far
apart, then we can ignore the interaction between their associated side lobes
and choose d to equal or be less than the smaller of d
1
or d
2
, as was done
in Example 1
1 0.5 0 0.5 1
0
0.5
1
1.5
2
1

2
1 0.5 0 0.5 1
0
5
10
15
(x)
Curtin University, Australia 5-20
YH Leung (2005, 2006, 2007, 2008, 2012)
A useful rule of thumb for setting d is:
If the width of an in-band region is narrower than or equal to the width of the
narrowest transition region, then base choice of d on half the tolerance of this
in-band region
Otherwise, base choice of d on full tolerance of the in-band region
Curtin University, Australia 5-21
YH Leung (2005, 2006, 2007, 2008, 2012)
4 Kaiser Window Method

Kaiser proposed and studied following window

( )
( )
a
a
b
b
-

2
0
0
1
, 0
[ ]
( )
0, otherwise
n
I
n M
w n
I
(46)
where
0
( ) I represents zeroth order modified Bessel function of the first kind

( )

=



= +


2
0
1
1
( ) 1
! 2
k
k
x
I x
k
(47)
b is a shape parameter, and
2 M a = (48)



Kaiser windows for various b shown below
(i) Rectangular window is a special case ( b =0 )
(ii) As b increases, window taper increases, i.e. skirt of [ ] w n becomes lower


Fig. 15 Kaiser windows for various b

0 0.2 0.4 0.6 0.8 1
0
0.3
0.6
0.9
1.2
n/M
K
a
i
s
e
r

W
i
n
d
o
w

w
[
n
]


= 0
= 3
= 6
Curtin University, Australia 5-22
YH Leung (2005, 2006, 2007, 2008, 2012)
DTFTs of Kaiser windows for various b and M shown below
(i) For a given M, as b increases,
ml
D increases and
sl
A decreases
(ii) For a given b , as M increases,
ml
D decreases but
sl
A remains fixed



Fig. 16 DTFTs of Kaiser window for various b and M

0 0.2 0.4 0.6 0.8 1
100
75
50
25
0
(x)
|
W
(
e
j

)
/
W
(
e
j
0
)
|



(
d
B
)


M = 20
= 0
= 3
= 6
0 0.2 0.4 0.6 0.8 1
100
75
50
25
0
(x)
|
W
(
e
j

)
/
W
(
e
j
0
)
|



(
d
B
)


= 6
M = 10
M = 20
M = 40
Curtin University, Australia 5-23
YH Leung (2005, 2006, 2007, 2008, 2012)
Consider lowpass design specification of Fig. 5 repeated below

Fig. 5 Design specification of a lowpass filter

Suppose
1 2
d d d = = and define transition width
q q q D = -
s p
(49)



Kaiser gave following empirical procedure to design linear phase FIR filters

(i) Determine from design specifications, d and q D , and compute
d = -20log A (50)

(ii) Determine b with
b
- >

= - + -

<

0.4
0.1102( 8.7), 50
0.5842( 21) 0.07886( 21), 21 50
0, 21
A A
A A A
A
(51)

(iii) Determine M with
7


q
-
=
D
8
2.285
A
M (52)


7
A more recent formula is given below. We shall adhere, however, to Eq. (52) which is the expression
given in Oppenheim and Schafer.

q
q

>

5.794
, 21
7.95
, 21
2.285
A
M
A
A

d
2
d -
1
1
d +
1
1
q
( )
j
H e
0
q
p
q
s
q
p
( )
1
2
( ) ,
j
d c p s
H e
q
q q q = +
c
q
Curtin University, Australia 5-24
YH Leung (2005, 2006, 2007, 2008, 2012)
Kaiser claimed Eq. (52) will predict M to within 2 over a wide range of q D
and A
Thus implicitly, Kaiser claimed his design procedure will yield only a first-cut
design and some fine-tuning is still necessary



Example 2
Consider lowpass design of Example 1 where
1
0.05 d = ,
2
0.1 d = , 0.25
p
q p = and 0.45
s
q p =

1. q q q p p p D = - = - = 0.45 0.25 0.2
s p


2. Since q D is less than the widths of the two in-band regions ( 2 0.25 0.5 p p = for passband
and 2 ( 0.45 ) 1.1 p p p - = for stopband), and d d >
2 1
, we set d to tighter of two tolerances, i.e.
d d = =
1
0.05

3. d = - = - = 20log 20log(0.05) 26.0206 A

4. Since 21 50 A
b = - + - =
0.4
0.5842( 21) 0.07886( 21) 1.5099 A A

5.
q p
- -
= = =
D
8 26.0206 8
12.5517
2.285 2.285 0.2
A
M
which is rounded up to =13 M to yield a Type II or IV filter

6. Assuming a Type II filter, impulse response given by, with q q q p = + = ( ) 2 0.35
c p s


( ) ( )
( )
p
p
-
-
-
= =
-
2
6.5
0
6.5
0
1.5099 1
sin 0.35 ( 6.5)
[ ] [ ] [ ] , 0 13
( 6.5) (1.5099)
n
d
I
n
h n h n w n n
n I


7. Impulse and magnitude responses of first-cut design are displayed below

0 5 10
0.1
0
0.1
0.2
0.3
0.4
n
h
[
n
]
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
(x)
|
H
(
e
j

)
|
Curtin University, Australia 5-25
YH Leung (2005, 2006, 2007, 2008, 2012)
8. Design clearly meets specification. To fine-tune design, we try reducing M to 12 but this will
violate specification at 0.25
p
q p = . We also try shifting q
c
to p 0.36 (since d d >
2 1
) and found
M can now be reduced to 12



Example 3
Figure below shows the design specification of a highpass filter

Fig. 17 Design specification of a highpass filter


Suppose d =
1
0.04 , d =
2
0.06 , q p = 0.1
s
and q p =0.35
p


1. q q q p p p D = - = - = 0.35 0.1 0.25
p s


2. Since q D is greater than the width of the stopband ( p p = 2 0.1 0.2 ) but less than the width of
the passband ( p p p - = 2 ( 0.35 ) 1.3 ), we set d as follows

{ } { }
d d d = = =
1 1
1 2
2 2
min , min 0.04, 0.06 0.03

3. d = - = - = 20log 20log(0.03) 30.4576 A

4. Since 21 50 A
b = - + - =
0.4
0.5842( 21) 0.07886( 21) 2.1809 A A

5.
q p
- -
= = =
D
8 30.4576 8
12.5137
2.285 2.285 0.25
A
M
which is rounded up to =13 M to yield a Type II or IV filter

6. Assuming a Type II filter, impulse response given by, with q q q p = + = ( ) 2 0.225
c s p


( ) ( ) ( )
( )
p p
p p
-
- - -

= = -


- -
2
6.5
0
6.5
0
2.1809 1
sin 6.5 sin 0.225 ( 6.5)
[ ] [ ] [ ]
( 6.5) ( 6.5) (2.1809)
n
d
I
n n
h n h n w n
n n I

d
2
d -
1
1
d +
1
1
q
( )
j
H e
0
q
p
q
s
q
p
( )
j
d
H e
q
c
q
Curtin University, Australia 5-26
YH Leung (2005, 2006, 2007, 2008, 2012)
7. Impulse and magnitude responses of design are displayed below


8. Clearly, design no good! In particular, ( ) 0
j
H e
q
= at q p =
Why? Filter is Type II which has property ( ) 0
j
H e
p
= . Therefore, must increase M to 14 to get
a Type I filter. Type I filters have no restrictions on their frequency response (see Table 1)
Impulse response of Type I filter, for 0 14 n , is given by

( ) ( )
( )
p
d
p
-
- -

= = - -


-
2
7
0
7
0
2.1809 1
sin 0.225 ( 7)
[ ] [ ] [ ] [ 7]
( 7) (2.1809)
n
d
I
n
h n h n w n n
n I

Impulse and magnitude responses of first-cut design are displayed below


9. Design clearly meets specification. Moreover, the ease with which the design meets the
specification suggests the possible existence of another good design with =12 M . It can be
shown that =12 M does indeed yield a satisfactory design

0 5 10
0.4
0.2
0
0.2
0.4
0.6
0.8
n
h
[
n
]
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
(x)
|
H
(
e
j

)
|
0 5 10
0.4
0.2
0
0.2
0.4
0.6
0.8
n
h
[
n
]
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
(x)
|
H
(
e
j

)
|
Curtin University, Australia 5-27
YH Leung (2005, 2006, 2007, 2008, 2012)
Example 4
Consider again a lowpass design but with
1 2
0.05 d d = = , 0.2
p
q p = and 0.45
s
q p =

1. 0.45 0.2 0.25
s p
q q q p p p D = - = - =

2. Since q D is less than both the passband and stopband widths, we set d as follows
{ }
1 2
min , 0.05 d d d = =

3. d = - = - = 20log 20log(0.05) 26.0206 A

4. b = - + - =
0.4
0.5842( 21) 0.07886( 21) 1.5099 A A

5.
8 26.0206 8
10.0414
2.285 2.285 0.25
A
M
q p
- -
= = =
D

which is rounded up to 11 M = to yield a Type II or IV filter

6. Assuming a Type II filter and that ( ) 2 0.325 ,
c s p
q q q p = + = impulse and magnitude responses
of first-cut design are plotted below


7. As can be seen, design does not meet specification. To fine-tune design, we can try increasing
M to 12 (which effectively decreases q D through Eq. (52)) but the new design still does not
meet specification. As it turns out, we have to increase M to 16 before the design meets
specification. This is clearly not desirable since we aim to keep M small

8. We next observe that before rounding up, 10.0414 M = and 1.5099. b = After rounding, M
is increased to 11 M = and by Eqs. (52) and (50), the corresponding values of A and d are
given by
2.285 8 11 2.285 0.25 8 27.7410 A M q p = D + = + =
and
20 27.7410 20
10 10 0.0410 0.05 ( )
A
d d
- -
= = = < =
In other words, we could have arrived at the same ( 11) M = by specifying a smaller d
0 5 10
0.1
0
0.1
0.2
0.3
0.4
n
h
[
n
]
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
(x)
|
H
(
e
j

)
|
Curtin University, Australia 5-28
YH Leung (2005, 2006, 2007, 2008, 2012)
But d is just peak side-lobe level of the Kaiser window [whose b is to be found using Eq. (51)].
Therefore, by reducing d , we reduce the ripple in the in-band regions of the first-cut design.
The idea is that, the reduction in peak side-lobe level may be sufficient to tame the design
violations at 0.15 q p in the magnitude response of the first-cut design
Following through with above argument, we obtain

0.4
0.5842( 21) 0.07886( 21) 1.7849 A A b = - + - =
It can be verified that a Kaiser window with 11 M = and 1.7849 b = will result in a filter that
meets the design specification

9. Alternatively, recall Kaiser claimed first-cut design will yield a M that is within 2 of the best
(smallest) M. Therefore, we can also try reducing M. It can be verified that a Kaiser window
with 10 M = and 1.5099 b = (the b from the first-cut design) will yield a filter that meets the
design specification
Above surprising result is just a (happy) coincidence of the complex manner by which the side
lobes of the window functions interact in the passband (see Fig. 14)

10. Finally, we can try shifting
c
q . It can be verified that shifting
c
q to the right will not lead to a filter
that satisfies the design specification, while shifting it left to 0.95 ( ) 2 0.30875
s p
q q p + = does
yield a satisfactory filter
Again, above surprising result is a happy coincidence of the complex manner by which the side
lobes of the window functions interact in the passband



Curtin University, Australia 5-29
YH Leung (2005, 2006, 2007, 2008, 2012)
Summary
(i) Examples 2 to 4 show Kaiser window method still involves some trial and
error, but compare to Example 1, only minor fine-tuning is required
8

(ii) Aim of fine-tuning is to find specification-meeting filter with smallest M
(iii) There are many ways to fine-tune first-cut design. Recall Eq. (19)
[ ] [ ] [ ]
d
h n h n w n =
We can adjust [ ] h n by
(a) adjusting [ ]
d
h n through shifting
c
q
(b) adjusting [ ]
d
h n through increasing/decreasing gain of ideal filter from
1 (this method not demonstrated in the examples)
(c) adjusting [ ] w n through increasing/decreasing M
(d) adjusting [ ] w n through increasing/decreasing d, or more directly,
through decreasing/increasing b rather than d
(e) a combination of the above methods


8
Why? Kaiser window method gives us a continuum of windows (as parameterised by b ) to choose
from. Therefore, the method is able to put us somewhere near the best design
Curtin University, Australia 5-30
YH Leung (2005, 2006, 2007, 2008, 2012)
5 Optimisation Method

Advantage of window method (and frequency sampling method) is that they
are intuitive and straightforward to implement
Disadvantage is that they can require much trial and error to fine-tune the
design (though less so with Kaiser window method)



Optimisation method also requires trial and error but effort involved is much less



There exist many optimisation methods. Best known is Parks-McClellan



Suppose filter is Type I and ( )
j
d
H e
q
has zero phase, i.e. ( )
j
d
H e
q
.
Designed filter will then have frequency response

2 2
2 1
( ) [ ] [0] 2 [ ]cos
M M
j j n
n M n
H e h n e h h n n
q q
q
-
=- =
= = +

(53)



Parks and McClellan formulated filter design problem as following minimax
optimisation problem

q p
q






[ ], 0 0
min max ( )
h n n M
E (54)
where
q q
q q

= -


( ) ( ) ( ) ( )
j j
d
E W H e H e (55)
2 M M

= , and where ( ) W q is a weighting function





( ) W q specifies transition regions ( ) ( ) 0 W q = and in-band tolerances (large
( ) W q for small ) tolerance

Curtin University, Australia 5-31
YH Leung (2005, 2006, 2007, 2008, 2012)
Parks and McClellan solved optimisation problem by applying the alternation
theorem
9
from Chebyshev approximation theory to derive a numerical
algorithm based on the Remez exchange algortihm



Result is that ( )
j
H e
q
will exhibit a ripple of equal amplitude in passband
and another ripple of equal amplitude in stopband. (These two ripples do not
necessarily have same amplitude)
Parks-McClellan method often known as equiripple method



Parks and McClellan have extended their Type I design method to Types II, III
and IV



Parks-McClellan implemented in MATLAB by the firpm function in Signal
Processing Toolbox



firpm can design any multiband linear phase FIR filters

Fig. 18 Desired frequency response specification for equiripple design


9
See A. V. Oppenheim and R. W. Schafer, Discrete-Time Signal Processing, 3rd ed., Prentice-Hall,
2010, pp. 583-593
( )
j
d
H e
q
0
q
p
T
r
a
n
s
i
t
i
o
n

r
e
g
i
o
n
T
r
a
n
s
i
t
i
o
n

r
e
g
i
o
n
Curtin University, Australia 5-32
YH Leung (2005, 2006, 2007, 2008, 2012)
firpm called as follows:
b = firpm(N, f, a)
or b = firpm(N, f, a, w)
or b = firpm(N, f, a, ftype)
or b = firpm(N, f, a, w, ftype)

N is filter length less 1, i.e. M = N
f is a vector of pairs of frequency points (scaled by p and in ascending
order) specifying the band edges. Frequency bands must not be adjacent
a is a vector (same length as f) specifying the desired magnitude response
at the band edges
w is a vector (length half that of f) specifying the weights in the frequency
bands



firpm assumes in-bands and transition regions are interleaved and the
in-band desired frequency response is linear between the specified gains at
the band edges



By default, firpm designs a Type I or II filter. For Type III or IV, specify
ftype as hilbert



See MATLAB Help on firpm for more options and details



Can also do Parks-McClellan design in MATLABs FDAtool
FDAtool also does window method but not frequency sampling method
10



10
Window and frequency sampling design method are implemented by the MATLAB functions fir1
and fir2 respectively
Curtin University, Australia 5-33
YH Leung (2005, 2006, 2007, 2008, 2012)
Example 5
Consider again lowpass Type I/II FIR filter design problem of Examples 1 and 2 where
1
0.05 d = ,
2
0.1 d = , 0.25
p
q p = and 0.45
s
q p =


In Example 1, smallest M found is 22 while in Example 2, it is 12. Figure below shows frequency
response of filter obtained from Parks-McClellan for 10, 11, 12, 13 M =


MATLAB code fragment used to obtain design for 10 M = is given below
f = [0 0.25 0.45 1] ;
a = [1 1 0 0] ;
w = [1/delta1 1/delta2] ;
M = 10 ;
h = firpm(M, f, a, w) ;
H = freqz(h, 1, 1024) ;
plot((0:1023)/1024, abs(H)) ;

Figure shows design improves with increasing M . Closer examination reveals the 10 M = design will
just violate the design specification and smallest possible M is 11

Finally, notice how all designs exhibit equiripple-ness in their in-band frequency response
d
2
d -
1
1
d +
1
1
q
( )
j
H e
0
q
p
q
s
q
p
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
(x)
|
H
(
e
j

)
|


M = 10
M = 11
M = 12
M = 13
Curtin University, Australia 5-34
YH Leung (2005, 2006, 2007, 2008, 2012)
Example 6
A differentiator has ideal frequency response
11


diff
( ) ,
j
H e j
q
q p q p = -
However, the high gain at high frequencies can end up only amplifying noise if the input signal to the
differentiator has little or no high frequency components (particularly since input signal must be
bandlimited before sampling). Ideal frequency response of a more practical differentiator is given by

d
,
( )
0, ,
p p
j
s p s
j
H e
q
q q q q
q q p q q

< < <


Suppose
1
0.05 d = ,
2
0.1 d = , 0.6
p
q p = and 0.8
s
q p = . Parks-McClellan MATLAB code is given by
f = [0 0.6 0.8 1] ;
a = [0 0.6*pi 0 0] ;
w = [1/delta1 1/delta2] ;
M = 14 ;
h = -firpm(M, f, a, w, hilbert) ; (Why ve sign?)
H = freqz(h, 1, 1024) ;
plot((0:1023)/1024, abs(H)) ;

From magnitude response, smallest M that meets specification was found to be 14. Corresponding
impulse response sequence is also plotted, showing its anti-symmetrical nature (Type III)

Exercise. Repeat above design problem using the Kaiser window method


11
Thus if implemented as a linear phase FIR filter, filter will be Type III or Type IV
( )
j
d
H e
q
0
q
p
q
s
q
p
d
2
1
d
0 3 6 9 12
0.8
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8
n
h
[
n
]
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
(x)
|
H
(
e
j

)
|


M = 13
M = 14
Curtin University, Australia 5-35
YH Leung (2005, 2006, 2007, 2008, 2012)
Appendix I Difference Routing Digital Filter (DRDF)

Consider following filter structure

Fig. 19 Difference routing digital filter



As can be seen from Fig. 19

1 ( 1)
0 1
1
( )
1
M
M
b b z b z
H z
z
- - +
-
+ + +
=
-

(56)



Suppose [ ] [ ] x n n d = . By following propagation of this impulse through the filter,
it can be seen that

0 1
0 1 1
, 0
[ ]
, ( 1)
n
M
b b b n M
h n
b b b n M
+

+ + +

+ + + +

(57)



It follows from Eq. (57) that
[ ] [ 1], 1, , 1
n
b h n h n n M = - - = + (58)
Above relation leads to the name difference routing



Eq. (57) also shows that if

0 1 1
0
M
b b b
+
+ + + = (59)
then DRDF is FIR with impulse response length 1 M +
y[n]
1
z
-
1
z
-

x[n]
0
b
1
b
1 M
b
+
1
z
- 1
z
-
Curtin University, Australia 5-36
YH Leung (2005, 2006, 2007, 2008, 2012)
FIR-DRDF has linear phase if
Types I, II
1
, 0, , 1
i M i
b b i M
+ -
= - = + (60)
Types III, IV
1
, 0, , 1
i M i
b b i M
+ -
= = + (61)

Proof
Recall FIR-DRDF has impulse response length 1 M + . Suppose filter is Type I such that M
is even, and we require
[ ] [ ], 0, , h n h M n n M = - = (62)
Starting with
2
M
n = . We have

2 2 2
[ ] [ ] [ ]
M M M
h h M h = - = (63)
which leads to nowhere. We next consider
2
1
M
n = - . Eq. (62) yields

2 2 2
[ 1] [ ( 1)] [ 1]
M M M
h h M h - = - - = + (64)
Substituting in Eq. (57), we get

2 2
0 0
1 1
M M
b b b b
- +
+ + = + + (65)
i.e.
2 2
1
0
M M
b b
+
= + (66)
i.e.
2 2 2
1 1
M M M
M
b b b
+ + -
= - = - (67)
We next consider
2
2
M
n = - . Eq. (62) now yields

2 2 2
[ 2] [ ( 2)] [ 2]
M M M
h h M h - = - - = + (68)
and from Eqs. (57) and (67), we get

2 2 2
0 0
2 1 2
M M M
b b b b b
- + +
+ + = + + + (69)
i.e.
2 2 2 2
1 1 2
0
M M M M
b b b b
- + +
= + + + (70)
i.e.
2 2
1 2
0
M M
b b
- +
= + (71)
i.e.
2 2 2
1 2 1 ( 1)
M M M
M
b b b
- + + - -
= - = - (72)
Continuing in the same fashion, we can prove Eq. (60) for a Type I filter.

The proofs for Type II, III and IV filters are similarly constructed.

Curtin University, Australia 5-37
YH Leung (2005, 2006, 2007, 2008, 2012)
We can show further that a linear phase FIR-DRDF possesses the following
properties
Type II
1
2
0
M
b
+
= (73)
Type III
2
( 2) 1
0
M
M
i
i
b b
-
=
= -

(74)
Type IV
1
2
( 1) 2
0
2
M
M
i
i
b b
+
-
=
= -

(75)

Proof
(a) Eq. (73) follows since, from Eq. (60)

1 1 1
2 2 2
1
M M M
M
b b b
+ + +
+ -
= - = -

(b) Eq. (74) follows since, from Eqs. (59) and (61) and for M even
( ) ( ) ( )
0 2 ( 2) 1 1 0 2
2
0
M M M M
b b b b b b
+ +
+ + + + + = + +
=



(c) Eq. (75) follows since, from Eqs. (59) and (61) and for M odd
( ) ( )
( )
0 ( 1) 2 ( 1) 2 ( 3) 2 1
0 ( 1) 2 ( 1) 2
2
0
M M M M
M M
b b b b b
b b b
- + + +
- +
+ + + + + +
= + + +
=





Exercise
Design a DRDF filter with the following impulse responses
(a) { }
5
0
[ ] 1, 2, 3, 3, 2, 1
n
h n
=
=
(b) { }
5
0
[ ] 1, 2, 3, 3, 2, 1
n
h n
=
= - - -

Ans
It follows from Eqs. (57) and (58) that
(a) { }
6
0
1, 1, 1, 0, 1, 1, 1
n
n
b
=
= - - -
(b) { }
6
0
1, 1, 1, 6, 1, 1, 1
n
n
b
=
= - - - - - -

Curtin University, Australia 5-38
YH Leung (2005, 2006, 2007, 2008, 2012)
Appendix II Frequency Sampling Method

General procedure:
1. Choose an integer M
2. From design specification, determine a desired frequency response
q
( )
j
d
H e
3. Sample ( )
j
d
H e
q
at 1 M + equally spaced frequency points from 0 q = to
2p

1
2 ( )
2
1
[ ] ( ) , 0, , , 0 or
j
k d
M
H k H e k M
q
p g
q
g
+
=
+
= = = (76)

Fig. 20 Sampling of frequency points

4. Filter impulse response [ ] h n , 0 n M , given by

p
g
p
p
p
g
g
+
+
+
+
+
=
=
=

= =

2
1
1
1 2
1
0
2
0
1
2
0
1
[ ] , 0
1
1
[ ] [ ]
1
[ ] ,
1
nk
M
k
M
n
M nk
M
M
j
M
k
j n
j
M
k
j
k
H k e
M
h n H k e
M
e
H k e
M
(77)
or in vector-matrix notation
M odd
M even
0 g =
1
2
g =
Curtin University, Australia 5-39
YH Leung (2005, 2006, 2007, 2008, 2012)

pg p p p
p p p pg
pg p p p
+ + + +
+ + +
+
+ + + +
-
-
-







=

+






2 2 4 2
1 1 1 1
8 4 4 4
1 1 1
1
2
2 2 4 2
1 1 1 1
[0] 1 1 1 1
[0]
1 [1]
1
1
[2]
1
1 [ ]
M
M M M M
M
M M M
M
M M M M
M M M M
j j j j
j j j
j
j j j j
h
H
e e e e h
H
e e e
e h
M
e e e e h M











[1]
[2]
[ ]
H
H M
(78)

5. Verify design. Adjust M and/or g as necessary and return to Step 2



Remarks
(i) At sampled frequency points

2 ( ) 2 ( )
1 1
( ) ( ) , 0, ,
k k
M M
j j
d
H e H e k M
p g p g
q q
q q
+ +
+ +
= =
= = (79)
(ii)
2
1 1
1 0
[ ]
nk
M
j M
M k
H k e
p
+
+ =

in Eq. (77) is inverse DFT (see later) of { }


0
[ ]
M
k
H k
=
,
evaluated at n
(iii) It can be shown that (Exercise)

g
g

=-

=-

+ + =

- + + =

1
2
[ ( 1)], 0
[ ]
( 1) [ ( 1)],
d
m
m
d
m
h n m M
h n
h n m M
(80)
i.e., sampling in frequency can lead to temporal aliasing duality
(iv) With some thought, it can be seen that frequency sampling method not
limited to the design of linear phase FIR filters only
All one has to do is to specify a non-linear phase
q
( )
j
d
H e

Curtin University, Australia 5-40
YH Leung (2005, 2006, 2007, 2008, 2012)
Example
Consider lowpass design problem of Examples 1 and 2 where
1
0.05 d = ,
2
0.1 d = , 0.25
p
q p = and
0.45
s
q p =

Fig. 5 Design specification of a lowpass filter
Suppose
q
( )
j
d
H e is as indicated and filter is Type I/II, i.e.

q
q
q q q
-

2
,
( )
0, otherwise
j M
j
c c
d
e
H e
Figure below shows
q
( )
j
H e for various M , and 0 g = and 0.5


For 0 g = , smallest M that meets design specification is 39, while for 0.5 g = , smallest M is 19.
Interestingly, for both 0 g = and 0.5 g = , increasing M beyond the respective smallest values does
not guarantee design will remain in specification

It was also found that if
q
( )
j
d
H e is changed from brickwall characteristic shown in Fig. 5 to one that
decrease linearly across transition region, then smallest M required is 14 for 0 g =

Clearly, one can try other functional forms for
q
( )
j
d
H e across the transition region



Frequency sampling method involves much trail and error
d
2
d -
1
1
d +
1
1
q
( )
j
H e
0
q
p
q
s
q
p
( )
1
2
( ) ,
j
d c p s
H e
q
q q q = +
c
q
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
(x)
|
H
(
e
j

)
|


= 0
M = 38
M = 39
M = 42
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
(x)
|
H
(
e
j

)
|


= 0.5
M = 18
M = 19
M = 20
Curtin University, Australia 5-41
YH Leung (2005, 2006, 2007, 2008, 2012)
Problems


1. Verify Eq. (29) and Fig. 9.


2. (a) We wish to design a Type I linear phase FIR filter with 6 M = using the window
method. Suppose the desired ideal discrete-time filter is a lowpass filter with
cut-off frequency 0.4
c
q p = , and the window function is the Hamming window.
Determine the impulse response of the filter.
(b) Repeat Part (a) but for a Type II filter with 5 M = .
(c) Repeat Part (a) but for a Type III filter ( 6 M = ).


3. We wish to design an FIR lowpass filter satisfying the specifications
0.95 ( ) 1.05,
j
H e
q
< < 0 0.25 q p
0 ( ) 0.1,
j
H e
q
< < 0.35p q p
by applying a window [ ] w n to the impulse response [ ]
d
h n for the ideal discrete-time
lowpass filter with cutoff 0.3 q p =
c
. Which of the windows listed in Table 2 of the
Lecture Notes can be used to meet this specification? For each window that you claim
will satisfy this specification, give the minimum length 1 + M required for the filter.


4. We wish to design an FIR lowpass filter satisfying the specifications
0.98 ( ) 1.02,
j
H e
q
< < 0 0.63 q p
( ) 0.15,
j
H e
q
< 0.65p q p
by applying a Kaiser window to the impulse response [ ]
d
h n of the ideal lowpass filter
with cutoff 0.64
c
q p = . Find the necessary Kaiser window parameters b and M .


Curtin University, Australia 5-42
YH Leung (2005, 2006, 2007, 2008, 2012)
5. We wish to use the Kaiser window method to design a discrete-time FIR filter with
generalised linear phase that meets specifications of the following form:
( ) 0.01,
q
<
j
H e 0 0.25 q p
0.95 ( ) 1.05,
q
< <
j
H e 0.35 0.6 p q p
( ) 0.01,
q
<
j
H e 0.65p q p
(a) Determine the minimum length 1 + M of the impulse response and the Kaiser
window parameter b for the filter to meet the preceding specifications, assuming
the transfer function of the filter is to have the form
2
( ) ( )
q q q -
=
j j jM
H e A e e
where ( )
q j
A e is real and even.
(b) What is the delay of the filter?
(c) Determine the ideal impulse response [ ]
d
h n .


6. We wish to use the Kaiser window method to design an FIR filter with generalised
Type I/II linear phase that meets the following specifications:
0.9 ( ) 1.1,
j
H e
q
< < 0 0.2 q p
( ) 0.06,
j
H e
q
< 0.3 0.475 p q p
1.9 ( ) 2.1,
j
H e
q
< < 0.525p q p
This specification is to be met by applying the Kaiser window to the ideal impulse
response associated with the ideal frequency response given by

1, 0 0.25
( ) 0, 0.25 0.5
2, 0.5
j
d
H e
q
q p
p q p
p q p


(a) What is the maximum value of d that can be used to meet this specification?
What is the corresponding value of b ? Explain your reasoning.
(b) What is the maximum value of q D that can be used to meet this specification?
What is the corresponding value of M ? Explain your reasoning.


Curtin University, Australia 5-43
YH Leung (2005, 2006, 2007, 2008, 2012)
7. Let [ ]
d
h n denote the impulse response of an ideal desired system with corresponding
frequency response ( )
j
d
H e
q
, and let [ ] h n and ( )
j
H e
q
denote the impulse response and
frequency response, respectively, of an FIR approximation to the ideal system. Assume
that [ ] 0 h n = for 0 n < and n M > . We wish to choose the 1 M + samples of the
impulse response so as to minimise the mean-square error of the frequency response
defined as

2
2
1
( ) ( )
2
j j
d
H e H e d
p
q q
p
e q
p
-
= -


(a) Use Parsevals relation to express the error function in terms of the sequences
[ ]
d
h n and [ ] h n
(b) Using the result of Part (a), determine the values of [ ] h n for 0 n M that
minimises
2
e .
(c) The FIR filter determined in Part (b) could have been obtained by a windowing
operation. That is, [ ] h n could have been obtained by multiplying the desired
infinite-length sequence [ ]
d
h n by a certain finite-length sequence [ ] w n . Deter-
mine the necessary window [ ] w n such that the optimal impulse response is
[ ] [ ] [ ]
d
h n w n h n = .


8. An ideal discrete-time Hilbert transformer is a system that introduces 90 - ( 2 p -
radians) of phase shift for 0 q p < < and 90 + ( 2 p + radians) of phase shift for
0 p q - < < . The magnitude of the frequency response is constant (unity) for 0 q p < <
and for 0 p q - < < . Such systems are also called ideal 90-degree phase shifters.
(a) Give an equation for the ideal frequency response ( )
j
d
H e
q
of an ideal discrete-
time Hilbert transformer that also includes constant (non-zero) group delay. Plot
the phase response of this system for p q p - < < .
(b) What type(s) of FIR linear-phase systems (I, II, III, or IV) can be used to
approximate the ideal Hilbert transformer in Part (a)?
(c) Suppose that we wish to use the window method to design a linear-phase
approximation to the ideal Hilbert transformer. Use ( )
j
d
H e
q
given in Part (a) to
determine the ideal impulse response [ ]
d
h n if the FIR system is to be such that
[ ] 0 h n = for 0 n < and n M > .
(d) What is the delay of the system if 21 M = ? Sketch the magnitude response of the
FIR approximation for this case, assuming a rectangular window.
(e) What is the delay of the system if 20 M = ? Sketch the magnitude response of the
FIR approximation for this case, assuming a rectangular window.
Curtin University, Australia 5-44
YH Leung (2005, 2006, 2007, 2008, 2012)
9. Consider the following ideal frequency response for a multiband filter

2
2
, 0 0.3
( ) 0, 0.3 0.6
0.5 , 0.6
j M
j
d
j M
e
H e
e
q
q
q
q p
p q p
p q p
-
-


The impulse response [ ]
d
h n is multiplied by a Kaiser window with 48 M = and
3.68 b = , resulting in a linear-phase FIR system with impulse response [ ] h n .
(a) What is the delay of the filter?
(b) Determine the ideal impulse response [ ]
d
h n .
(c) Determine the set of approximation error specifications that is satisfied by the FIR
filter, i.e., determine the parameters
1
d ,
2
d ,
3
d , B , C ,
1 p
q ,
1 s
q ,
2 s
q , and
2 p
q in

1 1
( ) ,
j
B H e B
q
d d - +
1
0
p
q q

2
( ) ,
j
H e
q
d
1 2 s s
q q q

3 3
( ) ,
j
C H e C
q
d d - +
2 p
q q p


10.
*
Prove Eq. (79). That is, show that in the frequency sampling method, the frequency
response of the designed filter and the desired frequency response satisfy

2 ( ) 2 ( )
1 1
( ) ( ) , 0, ,
k k
M M
j j
d
H e H e k M
p g p g
q q
q q
+ +
+ +
= =
= =


11.
*
Derive Eq. (80) of the Lecture Notes. That is, show, in the frequency sampling method
to design FIR filters, the designed impulse response [ ] h n is related to the impulse
response of the ideal filter, [ ]
d
h n , by the time aliasing expression

1
2
[ ( 1)], 0
[ ]
( 1) [ ( 1)],
d
m
m
d
m
h n m M
h n
h n m M
g
g

=-

=-

+ + =

- + + =



Curtin University, Australia 5-45
YH Leung (2005, 2006, 2007, 2008, 2012)
12.
*
The ideal magnitude response of a linear phase FIR filter is shown below.



Design the (Type II) filter using the frequency sampling method with 0 g = and
9 M = . List the filter coefficients.


13.
*
It is found that the distortion affecting a digital signal can be modelled by a system
whose impulse response is given by
[0] 1, [1] 1.3, [2] 0.2, [ ] 0, 3 = = = = h h h h n n
Using the frequency sampling method, design an FIR equalising filter which has 5
coefficients. (An equalising filter is expected to remove the effect of the distortion.)

( )
q j
d
H e
0
0.2p
q
p
0.5p
1
Curtin University, Australia 5-46
YH Leung (2005, 2006, 2007, 2008, 2012)
Answers


2. (a) { }
6
0
[ ] 0.0050, 0.0290, 0.2331, 0.4, 0.2331, 0.0290, 0.0050
n
h n
=
= - -
(b) { }
5
0
[ ] 0, 0.0803, 0.3413, 0.3413, 0.0803, 0
n
h n
=
=
(c) { }
6
0
[ ] 0.0154, 0.0893, 0.1694, 0, 0.1694, 0.0893, 0.0154
n
h n
=
= - - -
Note, however, that a Type III filter is not suitable for lowpass design. See Table
1, pp. 5.


3. Hanning: 1 81 M + =
Hamming: 1 81 M + =
Blackman: 1 121 M + =


4. Passband and stopband are wide enough compared to the transition width for us to say
{ } min 0.02, 0.15 0.02 d = =
First-cut design thus proceeds as follows
20 log 33.9794 A d = - =
0.65 0.63 0.02 q p p p D = - =

0.4
0.5842( 21) 0.07886( 21) 2.6523 A A b = - + - =

8
180.9519 181
2.285
A
M
q
-
= =
D


A careful examination of the magnitude response obtained will reveal the first-cut filter
violates the design specification at around 0.63 q p = . This design violation may be
resolved by increasing M to 182.
0 0.2 0.4 0.6 0.8 1
0
0.5
1
1.5
f (normalised to half sampling frequency)
M
a
g
n
i
t
u
d
e

R
e
s
p
o
n
s
e
Curtin University, Australia 5-47
YH Leung (2005, 2006, 2007, 2008, 2012)
5. (a) Design specification is for a bandpass filter. Bandpass filters involve 4 window
functions as shown below.
12


Therefore, for each in-band region, there are now 4 interacting window functions.
However, we can safely assume that it is only the two window functions immediately
on either side of an in-band region that have the greatest influence on the ripple in that
in-band region. Accordingly, we proceed as follows.
The narrowest transition region is given by
{ } min (0.35 0.25 ), (0.65 0.6 ) 0.05 q p p p p p D = - - =
which is much smaller than all the in-band widths. Therefore, design equations are
{ } min 0.01, 0.05, 0.05, 0.01 0.01 20 log 40 d d = = = - = A

0.4
0.5842( 21) 0.07886( 21) 3.3953 A A b = - + - =

8
2.285
89.1546 90
q
-
D
= =
A
M

A careful examination of the frequency response obtained will show the designed filter
violates the design specifications at around 0.657 q p = . The design violation can be
resolved by increasing M to 91.

12
See also A. V. Oppenheim and R. W. Schafer, Discrete-Time Signal Processing, 3rd ed., Prentice-Hall, 2010,
pp. 570 and pp. 579
1 0.5 0 0.5 1
0
0.5
1
1.5
1 0.5 0 0.5 1
0
20
40
60
(x)
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
f (normalised to half sampling frequency)
M
a
g
n
i
t
u
d
e

R
e
s
p
o
n
s
e
Curtin University, Australia 5-48
YH Leung (2005, 2006, 2007, 2008, 2012)
(b) In terms of the first-cut design, since filter is linear phase, its delay is 2 M =
90 2 45 = samples.
(c) Choosing the two
c
q s to be half-way between the stopband and passband edges,
impulse response of the first-cut design is

sin 0.625 ( 45) sin 0.3 ( 45)
[ ] , (assuming Type I)
( 45) ( 45)
d
n n
h n
n n
p p
p p
- -
= -
- -



6. For first-cut design
(a) 2.1809 b =
(b) 62.5686 63 64 M =


7. (a) Define ( ) ( ) ( )
j j j
d
E e H e H e
q q q
= -
such that, by Parsevals relation

2
2 2
1
( ) [ ]
2
j
n
E e d e n
p
q
p
e q
p

-
=-
= =


where [ ] e n is the inverse DTFT of ( ) ( ) ( )
j j j
d
E e H e H e
q q q
= - , i.e.,

[ ], 0
[ ] [ ] [ ], 0
[ ],
d
d
d
h n n
e n h n h n n M
h n n M
<

= -

>



(b) Clearly,
2
e is minimised if [ ] [ ] 0
d
h n h n - = , i.e., [ ] [ ]
d
h n h n = for 0 n M .
(c) Since [ ] [ ]
d
h n h n = for 0 n M , the window is a length 1 M + rectangular
window.


8. (a) ( ) sgn( )
j j
d
H e j e
q aq
q
-
= - or
{ }
2
1 2 ( )
( )
j u
j
d
H e e
p
q aq
q

- -


=
(b) Types III and IV.
(c)
{ }
2
1
2 2
( )
2
1 cos( ) ,
[ ]
0,
p
p
-

- -

M
M M
n
d
M
n n
h n
n

(d) 10.5 samples.
(e) 10 samples.


Curtin University, Australia 5-49
YH Leung (2005, 2006, 2007, 2008, 2012)
9. (a) 24 samples.
(b)
{ }
sin0.3 ( 24) sin0.6 ( 24)
1
( 24) 2 ( 24)
[ ] [ 24]
n n
d
n n
h n n
p p
p p
d
- -
- -
= + - -
(c) The tightest set of parameters are:
1
0.25
p
q p = ,
1
0.35
s
q p = ,
2
0.55
s
q p = ,
2
0.65
p
q p = ,
1
0.0075634 d = ,
2
0.011345 d = ,
3
0.0037817 d = , 1 B = , and
0.5 C = . These parameters are tightest in the sense that, for example, we can
keep
1
d at 0.0075634 and increase
2
d and
3
d ; or keep
1 1 s p
q q - at 0.1p but make
2 2
0.1
p s
q q p - > .


11.
*
From Eqs. (76) and (77), we have
1 1
1 1
1 1
1 1
2 2
0
2 2
0
2 2
0
2 ( ) 2 ( )
1
[ ] ( )
1
1
[ ]
1
1
[ ]
1
1
[ ]
1
k k
M M
k k
M M
k k
M M
k
M M
M
j j n
d
k
M
j n j n
d
k n
M
j n j n
d
n k
j n n j n n
d
h n H e e
M
h n e e
M
h n e e
M
h n e e
M
g g
g g
g g
g
p p
p p
p p
p p
+ +
+ +
+ +
+ +
+ +
+ +
+ +
=

-
= =-

-
=- =
- -
=
+


=


+



=


+

=
+



0
M
n k

=- =








But
1
2 ( )
0
1, ( ) ( 1),
0, otherwise
k
M
M
j n n
k
M n n p M p
e
p
+
-
=
+ - = +



{ }
1
2 ( 1)
2
1
2
1
[ ] [ ( 1)] 1
1
[ ( 1)]
[ ( 1)], 0
[ ( 1)]( 1) ,
M
j p M
d
p
j p
d
p
d
p
p
d
p
h n h n p M e M
M
h n p M e
h n p M
h n p M
g
p
p g
g
g
+

+
=-

=-

=-

=-
\ = - + +
+
= - +

- + =

- + - =


Finally, making the substitution p m =- completes the proof.


12.
*
{ [ ] 0.036277, 0.038158, 0.033333, 0.196956, 0.344146, h n = - -
}
9
0
0.344146, 0.196956, 0.033333, 0.038158, 0.036277
n=
- -

Anda mungkin juga menyukai