You are on page 1of 7

EE518 Digital Signal Processing University of Washington

Autumn 2001 Dept. of Electrical Engineering

Lecture 17: FIR Design by Windowing, Kaiser Window & Optimal Approximation
Nov 28, 2001

Prof: J. Bilmes <bilmes@ee.washington.edu> TA: Mingzhou Song <msong@u.washington.edu>

17.1 FIR Filter Design by Windowing

The FIR techniques are based purely in discrete-time, unlike the previous techniques for IIR design that were designed
from the transformation of filters specified in continuous time.
Recall ideal LPF
1 |ω| < ωc


H(e ) =
0 else
and
sin ωc n
hd [n] = ∀n
πn

What happens if we just truncate hd [n] to a finite of samples?

hd [n] −M ≤ n ≤ M

h[n] =
0 else

It is equivalent to convolution in frequency domain of a sinc function and a rectangle function.


General case:
hd [n] 0≤n≤M

h[n] =
0 else
or could multiply it by some “window” function

h[n] = hd [n]w[n] (17.1)

When the window is rectangle


1 0≤n≤M

w[n] =
0 else
then Z π
jω 1
H(e ) = Hd (e jθ )W (e j(ω−θ) )dθ
2π −π

which is a periodic convolution between Hd (e jω ) and W (e jω ) and can be thought of as smearing.


Key idea: lots of different window functions w[n], each with different properties.


Hd (e jω ) = ∑ hd [n]e jωn (ideal response) (17.2)
n=−∞

Basic idea is to think of hd [n] as Fourier series representation of periodic signal Hd (e jω ).

17-1
17-2

Recall for periodic f (t) with period T



f (t) = ∑ F[k]e j2πkt/T
k=−∞
Z T /2
1
F[k] = f (t)e− j2πkt/T dt
T −T /2

Here time is continuous and periodic and frequency is discrete.


The dual is DTFT, where time is discrete and frequency is continuous and periodic.

F(e jω ) = ∑ f [n]e− j2πωn/ωs
n=−∞
Z ωs /2
f [n] =ωs F(e jω )e j2πωn/ωs dω
−ωs /2

Recall Gibbs phenomenon.


Any periodic signal can be represented by the sum of harmonically related sinusoids.
Ex:
N
fN (t) = ∑ f [k]e j2πkt/T
k=−N

If f (t) is a square wave, we get Gibbs phenomenon. (converge in mean square sense, i.e., energy ?? (manuscript p 2)
converge).
Recall uniform convergence:
fN , N = 1, 2, · · · converge uniformly on a domain E to a function f if for every ε > 0, there exists an N such that for
n ≥ N,
| fn (x) − fN (x)| ≤ ε ∀x (17.3)

Note, for a particular x, say x1


lim fN (x1 ) = f (x1 )
N→∞

But this is not uniform convergence. This does give us mean square convergence (MSC) (energy of difference goes to
zero):
lim ( fN (x) − f (x))2 dx = 0
N→∞
So, this is the same thing.
Hd (e jω ) is the (complex) periodic seq (??).
hd [n] is the “Harmonic series”, i.e., Z π
1
hd [n] = Hd (e jωn )dω
2π −π
and
N
Hd (e jω ) = ∑ hd [n]e− jωn
(N)

n=−N
will exhibit ripple for any finite N.
The big question is how to design w[n] so that we can control for ripple.
N
H(e jω ) = ∑ hd [n]e− jωn
n=−N
Z π
1
= Hd (e jθ )W (e j(ω−θ) )dθ (circular convolution)
2π −π
17-3

Note:

w[n] = 1, ∀n =⇒ W (e jω ) = ∑ 2πδ(ω + 2πk)
k=−∞

So we want something to look like this.


But we also have conflicting goals:

1) shorter w[n] to reduce computation


2) approximate impulse

Why is there a conflict?


Consider
WM (e jω ) =FT {wM [n]}
M
= ∑ e− jωn
n=0
1 − e− jω(M+1)
=
1 − e jω
sin[ω(M + 1)/2]]
=e jωM/2
sin(ω/2)
M+1 M+1
Note width of mainlobe, frequency 2π/(M + 1), ω = 2πΩ, frequency 1/(M + 1) or signal period M + 1, 2 , 3 ,
···
Points:

1) to decrease mainlobe width, can increase M.


2) side lobe area doesn’t decrease as M increases
=⇒ W (e j(ω−θ) ) slides by ideal filter, we get Gibbs oscillations that doesn’t decrease in amplitude as M increases.
(if this ?? (manuscript p4) bad, this can cause aliasing in real systems).

Approach: taper off the window generally. (i.e., multiply by w[n]), to get other trade offs of mainlobe width, filter
length M, and side lobe height.

17.1.1 Common Windows

Rectangular:
1, 0≤n≤M

w[n] =
0, else

Bartlett (triangular):
 2n/M, 0 ≤ n ≤ M/2

w[n] = 2 − 2n/M, M/2 < n ≤ M


0, else

Hanning:
0.5 − 0.5 cos(2πn/M), 0≤n≤M

w[n] =
0, else

Hamming:
0.54 − 0.46 cos(2πn/M), 0≤n≤M

w[n] =
0, else
17-4

Blackman
0.42 − 0.5 cos(2πn/M) + 0.08 cos(4πn/M), 0≤n≤M

w[n] =
0, else

Note the above windows are all “linear phase”, i.e., shifted version of a symmetric window.
There exist many of these window functions (lots of research papers on this stuff in the 1960’s and 1970’s).

17.1.2 Properties of Different Windows


• show page 470-471, M = 50

• rectangular has narrowest main lobe, but peak side lobe is ?? (manuscript p5) -13dB down =⇒ aliasing

• Bartlett, helps side.


side lobe width increases, down -25dB
but main lobe width increases significantly (by about 2)

• Hanning, much lower sidelobe, they taper off to very small.

• Hamming, even lower sidelobe amplitude (-41dB)

• Blackman, even lower sidelobe, but wider mainlobe

Linear phase
Since
w[M − n], 0≤n≤M

w[n] =
0, else

so periodic (??) about ? M/2


w[n] = w[2k − n] symmetric about k = M/2
=⇒
W (e jω ) = We (e jω )e− jωM/2
where We (e jω ) is real and even.
Ex:
hd [M − n] = hd [n]
=⇒
Hd (e jω ) = He (e jω )e− jωM/2
where He (e jω ) is real and even. =⇒
H(e jω ) = Ae (e jω )e− jωM/2
where Z π
1
Ae (e jω ) = He (e jθ )We (e j(ω−θ) )dθ
2π −π
i.e., need only to convolve the real and even part of the response.
The same holds when hd [M − n] = −hd [n] (anti-symmetric type III and IV filters).
17-5

|H(e jω )|

1 + δ1
PSfrag replacements
1 − δ1

∆ωm
Stopband
Passband

δ2
Transition
ω p1 ωc ω p2 π ω

Figure 17.1: LPF design

17.1.3 Important Example

LPF design parameters are shown in Fig 17.1


Note consider Z π
1
Ae (e jω ) = He (e jθ )We (e j(ω−θ) )dθ
2π −π
for what values of ω are Ae peaked and minimized?
Graphical view: Let main lobe width be ∆ωm . At ω = ωc − ∆ωl , there is an overshoot. At ω = ωc + ∆ωl there is an
undershoot. ωl is half the mainlobe width.
Typically we are given δ and ωc .
Is there a better way to use these than trial-and-error?

17.2 Kaiser Window

Kaiser window is very useful in practice.


Zero-th order modified Bessel function of first kind.

I0 [β(1 − [(n − α)/α]2 )1/2 ], 0≤n≤M



w[n] = (17.4)
0, else
where α = M/2, I0 (·) is Bessel function, β is a parameter that determines to some extent the “shape” of the filter.
M and β trade off sidelobe amplitude and mainlobe width.
Question: which one obviously controls mainlobe width? M.
β controls both width and tapering off (i.e., as β increases, width gets large but sidelobe amplitudes get smaller.)
Show picture (O&S) pg 475.
17-6

Kaiser empirically found formula going from δ, ωs , ω p to M and β.

∆ω =ωs − ω p
A = − 20 log10 δ

 0.1102(A − 8.7), A > 50


β= 0.5842(A − 21)0.4 + 0.07886(A − 21), 21 ≤ A ≤ 50


0.0, A < 21

and
A−8
M=
2.285∆ω
This makes it very easy to do filter design very quickly.
Key: this gives the window w[n], which is to be multiplied by the ideal impulse response h d [n] to get the actual filter
h[n] = w[n]hd [n].
M does not change ripple error (to achieve δ) this is determined by the sidelobe amplitude (determined by β, or type
of window).
Show table O&S 7.1 again.
So, better widths at same approximation error =⇒ Kaiser window is probably the best so far.

17.3 Optimal Approximation FIR Filters

How about mean square error?


hd [n], 0 ≤ n ≤ M

h[n] =
0, else

The mean square error is Z π


1
ε2 = |Hd (e jω ) − H(e jω )|2 dω (17.5)
2π −π

Simple truncation minimizes ε2 , but this has bad properties as we see =⇒ this is a poor error criterion. Why?

1) all frequency regions are weighted equally (we might need to put more emphases on certain frequencies)
2) why not minimize the maximum errors so that the error is distributed more evenly over the regions we are
interested in.
Recall Butterworth filter is overly accurate in one place. However, the elliptic filter has equiripple so that error
is distributed.

Basic idea: (skip details of the algorithm or the related proofs)

- Fix length of filter L = M/2 (assume L integer forward)


- Fix ω p , ωs (desired passband and stopband)
- Assume zero phase (we can make linear phase by delay)
L
Ae (e jω ) = ∑ he [n]e− jωn
n=−L

The goal is to find he [n].


17-7

- determine an error function


E(ω) = W (ω)[Hd (e jω ) − Ae (e jω )]
(note zero-phase, so everything is real here)

Ex: LPF LPF design parameters are shown in Fig 17.2

|H(e jω )|

1 + δ1

1 − δ1

PSfrag replacements

δ2

ωp ωs π ω

Figure 17.2: LPF design

1, 0 ≤ ω ≤ ωp


Hd (e ) =
0, ωs ≤ ω ≤ π

and
δ2 /δ, 0 ≤ ω ≤ ωp

W (ω) =
1, ωs ≤ ω ≤ π
So
E(ω) = W (ω)[Hd (e jω ) − Ae (e jω )]
When δ = δ2 , E(ω) is max error.
Then find he [n] that minimizes the maximum error
 
he [n] = argmin max |E(ω)|
he [n]:0≤n≤L ω6∈transition band

If this works, done.


If not, increase M until it works.
This uses the “Alteration Theorem”. Better than Kaiser in general.

You might also like