16
1 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 1 Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department of Electronic Systems Aalborg University, Denmark [email protected] Lecture 8: FIR Filter Design Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 2 Course at a glance Discrete-time signals and systems Fourier-domain representation DFT/FFT System analysis Filter design z-transform MM1 MM2 MM9, MM10 MM3 MM6 MM4 MM7, MM8 Sampling and reconstruction MM5 System structure System

Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

  • Upload
    buiminh

  • View
    222

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

1

Digital Signal Processing, VIII, Zheng-Hua Tan, 20061

Digital Signal Processing, Fall 2006

Zheng-Hua Tan

Department of Electronic Systems Aalborg University, Denmark

[email protected]

Lecture 8: FIR Filter Design

Digital Signal Processing, VIII, Zheng-Hua Tan, 20062

Course at a glance

Discrete-time signals and systems

Fourier-domain representation

DFT/FFT

Systemanalysis

Filter design

z-transform

MM1

MM2

MM9, MM10MM3

MM6

MM4

MM7, MM8

Sampling andreconstruction MM5

Systemstructure

System

Page 2: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

2

Digital Signal Processing, VIII, Zheng-Hua Tan, 20063

FIR filter design

Design problem: the FIR system function

Start from impulse response directly

Find the degree M andthe filter coefficients h[k]

to approximate a desired frequency response

⎩⎨⎧ ≤≤

=

= ∑=

otherwise ,00 ,

][

)(0

Mnbnh

zbzH

n

M

k

kk

MzMhzhhzH −− +++= ][...]1[]0[)( 1

Digital Signal Processing, VIII, Zheng-Hua Tan, 20064

Part I: FIR filter design

FIR filter designCommonly used windowsGeneralized linear-phase FIR filterThe Kaiser window filter design method

Page 3: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

3

Digital Signal Processing, VIII, Zheng-Hua Tan, 20065

Lowpass filter – as an example

Ideal lowpass filter

IIR filter: based on transformations of continuous-time IIR system into discrete-time ones.

FIR filter: how? is non-causal, infinite! ][nh

∞<<∞−=

⎩⎨⎧

≤<<

=

nn

nnh

eH

c

c

cjlp

,sin][

,0|| ,1

)(

πω

πωωωωω

Nc

c jH 22

)/(11|)(|ΩΩ+

poles

Digital Signal Processing, VIII, Zheng-Hua Tan, 20066

Design by windowing

Desired frequency responses are often piecewise-constant with discontinuities at the boundaries between bands, resulting in non-causal and infinteimpulse response extending from to , but

So, the most straightforward method is to truncate the ideal response by windowing and do time-shifting:

0][ , →±∞→ nhn d

∞∞−

][][otherwise ,0

|| ],[][

Mngnh

Mnnhng d

−=⎩⎨⎧ ≤

=

Page 4: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

4

Digital Signal Processing, VIII, Zheng-Hua Tan, 20067

Design by windowing

After Champagne & Labeau, DSP Class Notes 2002.

Digital Signal Processing, VIII, Zheng-Hua Tan, 20068

Design by rectangular window

In general,

For simple truncation, the window is the rectangular window

∫−−=

π

π

θωθω θπ

deHeHeH jjd

j )()(21)( )(

⎩⎨⎧ ≤≤

=

=

otherwise ,00 ,1

][

][][][

Mnnw

nwnhnh d

Page 5: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

5

Digital Signal Processing, VIII, Zheng-Hua Tan, 20069

Convolution process by truncation

Fig. 7.19

?t then wha, ,1][ ∞<<∞−= nnw )2(2)( reWr

j πωπδω ∑∞

−∞=

+=

band narrow be should )( ωjeW

Digital Signal Processing, VIII, Zheng-Hua Tan, 200610

Requirements on the window

Requirementsapproximates an impulse to faithfully

reproduce the desired frequency responsew[n] as short as possible in duration (the order of the filter) to minimize computation in the implementation of the filterConflicting

Take the rectangular window as an example.

, ,1][ ∞<<∞−= nnw )2(2)( reWr

j πωπδω ∑∞

−∞=

+=

band narrow be should )( ωjeW

)( ωjeW

Page 6: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

6

Digital Signal Processing, VIII, Zheng-Hua Tan, 200611

Rectangular window

M+1

M=7

π4constant

Digital Signal Processing, VIII, Zheng-Hua Tan, 200612

Part II: Commonly used windows

FIR filter designCommonly used windowsGeneralized linear-phase FIR filterThe Kaiser window filter design method

Page 7: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

7

Digital Signal Processing, VIII, Zheng-Hua Tan, 200613

Standard windows – time domain

Rectangular

Triangular

Hanning

Hamming

Blackman

⎩⎨⎧ ≤≤−

=otherwise ,00 ),/2cos(5.05.0

][MnMn

nwπ

⎪⎩

⎪⎨

⎧≤≤−

≤≤=

otherwise ,02/ ,/22

2/0 ,/2][ MnMMn

MnMnnw

⎩⎨⎧ ≤≤

=otherwise ,00 ,1

][Mn

nw

⎩⎨⎧ ≤≤−

=otherwise ,0

0 ),/2cos(46.054.0][

MnMnnw

π

⎩⎨⎧ ≤≤+−

=otherwise ,00 ),/4cos(08.0)/2cos(5.042.0

][MnMnMn

nwππ

Digital Signal Processing, VIII, Zheng-Hua Tan, 200614

Standard windows – figure

Fig. 7.21

Plotted for convenience. In fact, the window is defined only at integer values of n.

Page 8: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

8

Digital Signal Processing, VIII, Zheng-Hua Tan, 200615

Standard windows – magnitude

Digital Signal Processing, VIII, Zheng-Hua Tan, 200616

Standard windows – comparison

Magnitude of side lobes vs width of main lobe

Independent of M!

Page 9: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

9

Digital Signal Processing, VIII, Zheng-Hua Tan, 200617

Part III: Linear-phase FIR filter

FIR filter designCommonly used windowsGeneralized linear-phase FIR filterThe Kaiser window filter design method

Digital Signal Processing, VIII, Zheng-Hua Tan, 200618

Linear-phase FIR systems

Generalized linear-phase system

Causal FIR systems have generalized linear-phase if h[n] satisfies the symmetry condition

MnnhnMh

MnnhnMh

,...,1,0 ],[][ or

,...,1,0 ],[][

=−=−

==−

constants real are and , offunction real a is )(

)()(

βαωω

βωαωω

j

jjjj

eA

eeAeH +−=

Page 10: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

10

Digital Signal Processing, VIII, Zheng-Hua Tan, 200619

Types of GLP FIR filters

1or 1,...,1,0 ],[][

−===−

εε MnnhnMh

Type IVType III

Type IIType I

M oddM even

1=ε

1−=ε

Digital Signal Processing, VIII, Zheng-Hua Tan, 200620

Generalized linear phase FIR filter

Often aim at designing causal systems with a generalized linear phase (stability is not a problem)

If the impulse response of the desired filter is symmetric about M/2, Choose windows being symmetric about the point M/2

is a real, even function of wthe resulting frequency response will have a generalized linear phase

2/)()( Mjje

j eeWeW ωωω −=

⎩⎨⎧ ≤≤−

=otherwise ,0

0 ],[][

MnnMwnw

)( ωje eW

][][ nhnMh dd =−

2/)()( Mjje

j eeAeH ωωω −= even and real is )( ωje eA

Page 11: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

11

Digital Signal Processing, VIII, Zheng-Hua Tan, 200621

Linear-phase lowpass filter – an example

Desired frequency response

so

apply a symmetric window a linear-phase system

∞<<∞−−−

=

⎩⎨⎧

≤<<

=−

nMn

Mnnh

eeH

clp

c

cMj

jlp

,)2/(

)]2/(sin[][

,0|| ,

)(2/

πω

πωωωωω

ω

][][ nhnMh lplp =−

][)2/(

)]2/(sin[][][][ nw

MnMn

nwnhnh clp −

−==

πω

Digital Signal Processing, VIII, Zheng-Hua Tan, 200622

Window method approximations

even and real is )(

)()(

even and real is )(

)()(

2/

2/

ω

ωωω

ω

ωωω

je

Mjje

j

je

Mjje

jd

eW

eeWeW

eH

eeHeH

=

=

∫−−

=

πθωθω

ωωω

θπ

deWeHeA

eeAeH

je

je

je

Mjje

j

)()(21)(

)()(

)(

2/

Page 12: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

12

Digital Signal Processing, VIII, Zheng-Hua Tan, 200623

Key parameters

To meet the requirement of FIR filter, chooseShape of the windowDuration of the window

Trail and error is not a satisfactory method to design filters a simple formalization of the window method by Kaiser

Digital Signal Processing, VIII, Zheng-Hua Tan, 200624

Part IV: Kaiser window filter design

FIR filter designCommonly used windowsGeneralized linear-phase FIR filterThe Kaiser window filter design method

Page 13: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

13

Digital Signal Processing, VIII, Zheng-Hua Tan, 200625

The Kaiser window filter design method

An easy way to find the trade-off between the main-lobe width and side-lobe areaThe Kaiser window

is the zeroth-order modified Bessel function of the first kind. is an adjustable design parameter.The length (M+1) and the shape parameter can be adjusted to trade side-lobe amplitude for main-lobe width (not possible for preceding windows!)

2/ otherwise ,0

0 ,)(

])]/)[(1([][ 0

2/120

M

MnInI

nw

=

⎪⎩

⎪⎨

⎧≤≤

−−=

α

βααβ

)(0 ⋅I0≥β

β

Digital Signal Processing, VIII, Zheng-Hua Tan, 200626

The Kaiser window

Page 14: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

14

Digital Signal Processing, VIII, Zheng-Hua Tan, 200627

Design FIR filter by the Kaiser window

Calculate M and to meet the filter specificationThe peak approximation error is determined by

Define then

Passband cutoff frequency is determined by:

Stopband cutoff frequency by:Transition width M must satisfy

δω −≥1|)(| jeH

βδ

β

δω ≤|)(| jeH

⎪⎩

⎪⎨

<≤≤−+

>−

=21 ,0.0

5021 ),21(07886.021)-0.5842(A

50 ),7.8(1102.00.4

AAA

AA

β

ps ωωω −=Δ

δ10log20−=A

ωΔ−

=285.2

8AM

(Peak error is fixed for other windows)

(Rectangular)

Digital Signal Processing, VIII, Zheng-Hua Tan, 200628

A lowpass filter Specifications

Specifications for a discrete-time lowpass filter

πωω

πωωω

ω

6.0 ,001.0|)(|

4.00 ,01.01|)(|01.01

=≥≤

=≤≤+≤≤−

sj

pj

eH

eH

001.001.0

2

1

==

δδ

Page 15: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

15

Digital Signal Processing, VIII, Zheng-Hua Tan, 200629

Design the lowpass filter by Kaiser window

Designing by window method indicating , we must setTransition width

The two parameters:Cutoff frequency of the ideal lowpass filter

Impulse response

60log20 10 =−= δA

001.0=δπωωω 2.0=−=Δ ps

21 δδ =

37 ,653.5 == Mβ

⎪⎩

⎪⎨

⎧≤≤

−−⋅

−−

=

otherwise ,0

0 ,)(

])]/)[(1([)(

)(sin][ 0

2/120 Mn

InI

nn

nhc

βααβ

απαω

πωωω 5.02/)( =+= psc

Digital Signal Processing, VIII, Zheng-Hua Tan, 200630

Design the lowpass filter

What is the group delay?

M/2=18.5

Page 16: Digital Signal Processing, Fall 2006 - kom.aau.dkkom.aau.dk/~zt/courses/DSP/MM8/Digital Signal Processing, MM8... · Digital Signal Processing, Fall 2006 Zheng-Hua Tan Department

16

Digital Signal Processing, VIII, Zheng-Hua Tan, 200631

Summary

FIR filter designCommonly used windowsGeneralized linear-phase FIR filterThe Kaiser window filter design method

Digital Signal Processing, VIII, Zheng-Hua Tan, 200632

Course at a glance

Discrete-time signals and systems

Fourier-domain representation

DFT/FFT

Systemanalysis

Filter design

z-transform

MM1

MM2

MM9, MM10MM3

MM6

MM4

MM7, MM8

Sampling andreconstruction MM5

Systemstructure

System