91
Copyright © 2005. Shi Pin g CUC Chapter 8 FIR Filter Design Conten t Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Embed Size (px)

Citation preview

Page 1: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Chapter 8FIR Filter Design

Content

Introduction

Properties of Linear-Phase FIR Filters

Window Design Techniques

Page 2: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Introduction

The advantages of the FIR digital filter

The phase response can be exactly linear;

They are relatively easy to design since there are no stability problems;

They are efficient to implement;

The DFT can be used in their implementation.

Page 3: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Introduction

The advantages of a linear-phase response

Design problem contains only real arithmetic and not complex arithmetic;

Linear-phase filter provide no delay distortion and only a fixed amount of delay;

For the filter of length N (or order N-1) the number of operations are of the order of N/2.

Page 4: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

The basic technique of FIR filter design

Window design techniques;

Frequency sampling design techniques;

Optimal equiripple design techniques.

Introduction

return

Page 5: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

The system function and frequency response

The system function of FIR filters

Let h(n), n=0,1,…,N-1 be the impulse response of length N. Then the system function is

1

0

)()(N

n

nznhzH

It has (N-1) poles at the origin and N-1 zeros located anywhere in the z-plane.

Page 6: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

The frequency response of FIR filters

)()(

1

0

)()(

)()(

jjj

M

n

njj

eHeeH

enheH

)( jeH Magnitude response function

Amplitude response function)(H

Page 7: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

)( jeH )(H The difference between and

)( jeH is always positive and the associated phase response is a discontinuous function.

may be both positive and negative and the associated phase response is a continuous function.

)(H

Consider the following example:

1)2( ,1)1( ,1)0( hhh

Page 8: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

jjj

n

njj

eee

enheH

)cos21(1

)()(

2

2

0

3/2

3/20 )(

0 ,cos21)( jeH

0 )(

cos21)(H

Page 9: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

Linear-phase conditions

)(

)(

)()( )(jj eHeH

d

d )( A constant group delay

1

0

)()(N

n

nznhzHFor

Page 10: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

)( For

The phase response is through the origin.

The phase response is not through the origin.

)1()( nNhnh

)1()( nNhnh

)( For

Page 11: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

Frequency response of linear-phase FIR filters

1

0

)1(1

0

)1(

1

0

1

0

)()]([

)]1([)()(

N

m

mNN

m

mN

N

n

nN

n

n

zmhzzmh

znNhznhzH

)()( 1)1( zHzzH N

Page 12: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

)()( 1)1( zHzzH N

1

0

)2

1()

2

1(

)2

1(

1

0

)1(

1)1(

]2

)[(

])[(2

1

)]()([2

1)(

N

n

nN

nN

N

N

n

nNn

N

zznhz

zzznh

zHzzHzH

Page 13: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Symmetric impulse response )1()( nNhnh

])2

1cos[()(

]2

[)(

)()(

1

0

)2

1(

)12

1()1

2

1(

1

0

)2

1(

nN

nhe

eenhe

zHeH

N

n

Nj

Nj

Nj

N

n

Nj

ez

jj

])2

1cos[()()(

1

0

nN

nhHN

n

)2

1()(

N

2

1

N

Page 14: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Antisymmetric impulse response )1()( nNhnh

])2

1sin[()(

]2

[)(

)()(

1

0

2)

2

1(

)12

1()1

2

1(

1

0

)2

1(

nN

nhe

eenhe

zHeH

N

n

jN

j

Nj

Nj

N

n

Nj

ez

jj

])2

1sin[()()(

1

0

nN

nhHN

n

2)

2

1()(

N

2

1

N

Page 15: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

Type 1: symmetric impulse response, N is odd

The properties of amplitude function )(H

])2

1cos[()()(

1

0

nN

nhHN

n

)cos()(

)cos()2

1(2)

2

1(

])2

1cos[()(2)

2

1()(

2/)1(

0

2/)1(

1

2/)3(

0

nna

mmN

hN

h

nN

nhN

hH

N

n

N

m

N

n

mnN

2

1

Page 16: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

)cos()()(2/)1(

0

nnaHN

n

)2

1()0(

N

ha

2

1,,2,1 ),

2

1(2)(

Nnn

Nhna

The middle sample

Page 17: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

Type 2: symmetric impulse response, N is even

])2

1cos[()()(

1

0

nN

nhHN

n

)]2

1(cos[)()(

2/

1

nnbHN

n

2,,2,1 ),

2(2)(

Nnn

Nhnb

Page 18: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

Type 3: antisymmetric impulse response, N is odd

])2

1sin[()()(

1

0

nN

nhHN

n

)sin()()(2/)1(

1

nncHN

n

2

1,,2,1 ),

2

1(2)(

Nnn

Nhnc

Page 19: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

Type 4: antisymmetric impulse response, N is even

])2

1sin[()()(

1

0

nN

nhHN

n

)]2

1(sin[)()(

2/

1

nndHN

n

2,,2,1 ),

2(2)(

Nnn

Nhnd

Page 20: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Properties of Linear-Phase FIR Filters

Zero locations of linear-phase FIR filters

)()( 1)1( zHzzH N

If has a zero at)(zH jrezz 1

Then for linear phase there must be a zero at

jerz

z 11

1

For a real-valued filter, there must be zeros at

jrezz 1je

rzz

11

1

return

Page 21: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Window Design Techniques

Basic window design idea

Choose a proper ideal frequency-selective filter (which always has a noncausal, infinite-length impulse response);

Then truncate (window) its impulse response to obtain a linear-phase and causal FIR filter.

The emphasis is on

Selecting an appropriate ideal filter;

Selecting an appropriate windowing function.

Page 22: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Window Design Techniques

Denote an ideal frequency-selective filter by )( jd eH

|| ,0

|| ,1)(

c

cj

jd

eeH

)(

)](sin[21

)()( 1

nn

deeeHFnhc

ccnjjjdd

c

c

)()( nRnw N

Page 23: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

21

otherwise ,0

10 ),()()()(

N

Nnnhnwnhnh d

d

otherwise ,0

10 ,)

21

(

)2

1(sin

)( NnN

n

Nn

nhc

cc

Windowing

Page 24: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

The effect of Window function

deWeHeH jjd

j )()(21

)( )(

)2

1()

21

(1

0

)()

2sin(

)2

sin()(

N

j

R

NjN

n

njjR eW

N

eeeW

1

0

)()(N

n

njj enweW

)2

sin(

)2

sin()(

N

WR

Page 25: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

)

21

()()(

N

j

dj

d eHeH

|| ,0

|| ,1)(

c

cdH

)2

1()

21

(

))(2

1()

21

(

)()()(21

)()(21

)(

N

j

Rd

Nj

Nj

R

Nj

dj

eHdWHe

deWeHeH

dWHH Rd )()(

21

)(

Page 26: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Window Design Techniques

The conclusion

The periodic convolution produces a smeared version of the ideal response )( j

d eH

Since the window has a finite length equal to N, its response has a peaky main lobe whose width is proportional to 1/N, and has side lobes of smaller heights.

)(nw

The main lobe produces a transition band in whose width is responsible for the transition width. This width is then proportional to 1/N. The wider the main lobe, the wider will be the transition width.

)( jeH

The side lobes produces ripples that have similar shapes in both the passband and stopband.

Page 27: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Window Design Techniques

Windowing functions Rectangular window

)2

sin(

)2

sin()(

)()( ),()()

21

(

N

W

eWeWnRnw

R

Nj

Rj

RN

This is the simplest window function but provides the worst performance from the viewpoint of stopband attenuation. The width of main lobe is N/4

Page 28: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Window Design Techniques

Gibbs phenomenon

The truncation of the infinite length will introduce ripples in frequency response . The oscillatory behavior near the band edge of the filter is called the Gibbs phenomenon.

)(H)(nhd

When the N is increased:The transition band of the filter will decreaseBut the relative amplitude of the peaky values will remain constant.

Page 29: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Bartlett window

1

2

1 ,

1

22

2

10 ,

1

2

)(Nn

N

N

n

Nn

N

n

nw

)1 ,1( ,

2sin

4sin

2)(

)2

1(

2

NNNe

N

NeW

Nj

j

Since the Gibbs phenomenon results from the fact that the rectangular window has a sudden transition from 0 to 1 (or 1 to 0), Bartlett suggested a more gradual transition in the form of a triangular window. The width of main lobe is N/8

Page 30: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Hanning window

This is a raised cosine window function given by:

)1(

)2

()2

(25.0)(5.0)(

N

NW

NWWW RRR

The width of main lobe is:N

8

)(1

2cos1

2

1)( nR

N

π nnw N

Page 31: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Hamming window

)(1

2cos46.054.0)( nR

N

π nnw N

This is a modified version of the raised cosine window.

The width of main lobe is:N

8

)1(

)2

()2

(23.0)(54.0)(

N

NW

NWWW RRR

Page 32: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Blackman window

)(1

4cos08.0

1

2cos5.042.0)( nR

N

π n

N

π nnw N

This is a 2-order raised cosine window.

The width of main lobe is:N

12

)1(

)4

()4

(04.0

)2

()2

(25.0)(42.0)(

N

NW

NW

NW

NWWW

RR

RRR

Page 33: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Kaiser window

)()(

12

11

)(0

2

0

nRI

Nn

I

nw N

This is one of the most useful and optimum windows.

Where is the modified zero-order Bessel function, and is a parameter that can be chosen to yield various transition widths and stopband attenuation. This window can provide different transition widths for the same N.

)(0 I

window Blackman 5.8

window Hamming 44.5

windowr rectangula 0

Page 34: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

The design equations for Kaiser window

Given spsp AR , , ,

ps The norm transition width:

286.2

95.7sANThe filter order N:

dB21 0

dB5021dB )21(07886.0)21(5842.0

dB50 )7.8(1102.04.0

s

sss

ss

A

AAA

AA

Page 35: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Summary of window function characteristics

Window name

Window function Filter

Peak value of side lobe

The width of main lobe

Transition width

Min. stopband attenuation

Rectangular -13 dB -21 dB

Bartlett -25 dB -25 dB

Hanning -31 dB -44 dB

Hamming -41 dB -53 dB

Blackman -57 dB -74 dB

N4

N8

N8

N8

N12

N8.1

N2.4

N2.6

N6.6

N11

Page 36: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Window Design Techniques

Design procedure

Given the ideal frequency response )( jd eH

Compute the impulse response of ideal filter)(nhd

Determine the window shape and N from the minimum stopband attenuation and the transition width

ps sA

Compute the impulse response of the designed filter)()()( nwnhnh d

Compute the frequency response of the designed filter and verify the performance

)( jeH

Page 37: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Window Design Techniques

Examples of FIR linear-phase filter design

Digital FIR lowpass filter

Design a digital FIR lowpass filter:

dB 50

sec)/rad(1032

sec)/rad(105.12

sec)/rad(105.12

3

3

4

s

s

p

sample

A

Example

Page 38: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Solution:

Compute the digital frequencies

2.0 ,3.02

4.02

,2.02

pssp

c

sample

ss

sample

pp

Derive the frequency response of ideal FIR lowpass filter

||3.0 ,0

3.0|| ,

|| ,0

|| ,)(

j

c

cj

jd

eeeH

Page 39: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Compute the impulse response of the ideal filter

Determine the window shape and N

)(

)](3.0sin[

)(

)](sin[

2

1)(

n

n

n

ndeenh

c

ccnjjd

c

c

dB 50sA

162

1 ,33 ,2.0

6.6

NN

N

Hamming

Page 40: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Compute the impulse response of the designed filter

)(16

cos46.054.0

)(1

2cos46.054.0)(

33 nRπ n

nRN

π nnw N

)16(

)]16(3.0sin[)(

n

nnhd

)(16

cos46.054.0)16(

)]16(3.0sin[

)()()(

33 nRπ n

n

n

nwnhnh d

Page 41: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Compute the frequency response of the designed filter

)]([DTFT)( nheH j

Verify the performance of the designed filter

dB 46

dB 073.0

s

p

A

R

It is not satisfied by this design

Let N = 34 and redesign

dB 52

dB 048.0

s

p

A

R

Page 42: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Window Design Techniques

Digital FIR highpass filter

An ideal FIR highpass filter can be obtained from two ideal FIR lowpass filters, provided they have the same phase response.

0

0 c

0 c

Page 43: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

The frequency response of an ideal FIR highpass filters

c

cj

jd

eeH

|| ,0

|| ,)(

The impulse response of an ideal FIR highpass filters

)(

)](sin[

)(

)](sin[2

1

)(2

1)(

)( )(

n

n

n

n

dede

deeHnh

c

njnj

njjd

c

c

Page 44: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Example

Design a digital FIR highpass filter :dB 5.0 ,6.0

dB 60 ,4.0

pp

ss

R

A

Solution:

Compute the digital frequencies

2.0 ,5.02

6.0 ,4.0

spsp

c

ps

Page 45: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Derive the impulse response of ideal FIR highpass filter

)27(

)]27(5.0sin[

)27(

)]27(sin[

)(

)](sin[

)(

)](sin[)(

n

n

n

n

n

n

n

nnh c

d

Determine the window shape and N

272

155 ,55 ,2.0

11

N

N

dB 60sA Blackman

Note: the N must be odd for FIR highpass filters

Page 46: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Compute the impulse response of the designed filter

)()()( nwnhnh d

)(54

4cos08.0

54

2cos5.042.0

)(1

4cos08.0

1

2cos5.042.0)(

55 nRπ nπ n

nRN

π n

N

π nnw N

Page 47: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Compute the frequency response of the designed filter

)]([DTFT)( nheH j

Verify the performance of the designed filter

dB 71

dB 0039.0

s

p

A

R

It is satisfied by this design

Page 48: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Window Design Techniques

Digital FIR bandpass filter

An ideal FIR bandpass filter can be obtained from two ideal FIR lowpass filters, provided they have the same phase response.

0 1c 2c

0 1c

0 2c

Page 49: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

The frequency response of an ideal FIR bandpass filters

otherwise ,0

|| ,)( 21 cc

jj

d

eeH

The impulse response of an ideal FIR highpass filters

)(

)](sin[

)(

)](sin[2

1

)(2

1)(

12

)( )(

2

1

1

2

n

n

n

n

dede

deeHnh

cc

njnj

njjd

c

c

c

c

Page 50: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Example

Design a digital FIR bandpass filter :

dB 1 ,35.0

dB 60 ,2.0

11

11

pp

ss

R

A

Solution:

Compute the digital frequencies

15.0)](),min[(

725.02

,275.02

2211

222

111

pssp

spc

spc

dB 60 ,8.0

dB 1 ,65.0

22

22

ss

pp

A

R

Page 51: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Derive the impulse response of ideal FIR bandpass filter

)5.36(

)]5.36(275.0sin[

)5.36(

)]5.36(725.0sin[

)(

)](sin[

)(

)](sin[)( 12

n

n

n

n

n

n

n

nnh cc

d

Determine the window shape and N

5.362

174 ,74 ,15.0

11

N

N

dB 60sA Blackman

Page 52: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Compute the impulse response of the designed filter

)()()( nwnhnh d

)(73

4cos08.0

73

2cos5.042.0

)(1

4cos08.0

1

2cos5.042.0)(

74 nRπ nπ n

nRN

π n

N

π nnw N

Page 53: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Compute the frequency response of the designed filter

)]([DTFT)( nheH j

Verify the performance of the designed filter

dB 73 dB, 73

dB 003.0 dB, 003.0

21

21

ss

pp

AA

RR

It is satisfied by this design

Page 54: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Digital FIR bandstop filter

An ideal FIR bandstop filter can be obtained from three ideal FIR lowpass filters, provided they have the same phase response.

0 1c 2c

0 1c

0 2c

0

Page 55: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

The frequency response of an ideal FIR bandpass filters

otherwise ,0

|| ,|| 0 ,)( 21

cc

jj

d

eeH

The impulse response of an ideal FIR highpass filters

)(

)](sin[

)(

)](sin[

)(

)](sin[2

1

)(2

1)(

12

)( )( )(

2

1

1

2

n

n

n

n

n

n

dedede

deeHnh

cc

njnjnj

njjd

c

c

c

c

Page 56: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Example

Design a digital FIR bandstop filter :

dB 40 ,4.0

dB 5.0 ,3.0

11

11

ss

pp

A

R

Solution:

Compute the digital frequencies

1.0)](),min[(

65.02

,35.02

2211

222

111

spps

spc

spc

dB 5.0 ,7.0

dB 40 ,6.0

22

22

pp

ss

R

A

Page 57: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Derive the impulse response of ideal FIR bandstop filter

Determine the window shape and N

312

163 63 ,62 ,1.0

2.6

NN

N

dB 40sA Hanning

)(

)](35.0sin[

)(

)](65.0sin[

)(

)](sin[

)(

)](sin[

)(

)](sin[

)(

)](sin[)( 12

n

n

n

n

n

n

n

n

n

n

n

nnh cc

d

Note: the N must be odd for FIR bandstop filters

Page 58: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Compute the impulse response of the designed filter

)()()( nwnhnh d

)(61

2cos1

2

1

)(1

2cos1

2

1)(

63 nRπ n

nRN

π nnw N

Page 59: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Compute the frequency response of the designed filter

)]([DTFT)( nheH j

Verify the performance of the designed filter

dB 44 dB, 44

dB 0884.0 dB, 0884.0

21

21

ss

pp

AA

RR

It is satisfied by this design

return

Page 60: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 2/3 1

-1

0

3

Magnitude Response

Frequency in pi units

0 2/3 1

-2/3

0

1/3

Piecewise Phase Response

Frequency in pi units

an

gle

in p

i un

its

0 2/3 1

-1

0

3

Amplitude Response

Frequency in pi units

0 2/3 1

-2/3

0

1/3

Phase Response

Frequency in pi units

an

gle

in p

i un

its

return

Page 61: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 0.5 1 1.5 2-10

-8

-6

-4

-2

0phase Response

Frequency in pi units0 1 2 3 4 5 6 7 8 9 10

0

1

2

3

4

5

6

h(n), N is odd

n

0 1 2 3 4 5 6 7 8 90

1

2

3

4

5

6

h(n), N is even

n

10N

return

2

1

)(

N

)1()( nNhnh

Page 62: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 0.5 1 1.5 2

-8

-6

-4

-2

00.5

Phase Response

Frequency in pi units0 1 2 3 4 5 6 7 8 9 10

0

h(n), N is odd

n

0 1 2 3 4 5 6 7 8 9

0

h(n), N is even

n

10N

return

2 ,

2

1

)(

N

)1()( nNhnh

Page 63: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 5 10

-5

0

5

10

n

h(n

)

Type-1 Impulse Response

0 0.5 1 1.5 2-20

-10

0

10

20

frequency in pi units

H(w

)

Type-1 Amplitude Response

-1 0 1

-1

-0.5

0

0.5

1

Real Part

Ima

gin

ary

Pa

rt

Type-1 Pole-Zero Plot

10

return

2 , ,0 偶对称

Page 64: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 5 10

-5

0

5

10

n

h(n

)

Type-2 Impulse Response

0 0.5 1 1.5 2-40

-20

0

20

40

frequency in pi units

H(w

)

Type-2 Amplitude Response

-1 0 1

-1

-0.5

0

0.5

1

Real Part

Ima

gin

ary

Pa

rt

Type-2 Pole-Zero Plot

11

return

奇对称

0|)( H

不能用来设计高通、带阻滤波器

Page 65: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 5 10

-5

0

5

10

n

h(n

)

Type-3 Impulse Response

0 0.5 1 1.5 2-40

-20

0

20

40

frequency in pi units

H(w

)

Type-3 Amplitude Response

-1 0 1

-1

-0.5

0

0.5

1

Real Part

Ima

gin

ary

Pa

rt

Type-3 Pole-Zero Plot

10

return

2 , ,0 奇对称0|)( 2,,0 H

不能用来设计低通、高通、带阻滤波器

Page 66: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 5 10

-5

0

5

10

n

h(n

)

Type-4 Impulse Response

0 0.5 1 1.5 2-10

0

10

20

30

frequency in pi units

H(w

)

Type-4 Amplitude Response

-1 0 1

-1

-0.5

0

0.5

1

Real Part

Ima

gin

ary

Pa

rt

Type-4 Pole-Zero Plot

11

return

2 , ,0 偶对称0|)( 0H

不能用来设计低通滤波器

Page 67: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

jIm[z]

Re[z]0

return

Quadruplet

Page 68: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

-10 -5 0 5 10 15 20 25 30-0.05

0

0.05

0.1

0.15

0.2

)(nhd

return

)()( nRnw N

Page 69: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

-10 -5 0 5 10 15 20 25 30-0.05

0

0.05

0.1

0.15

0.2

)(nhd

)()( nRnw N

return

Page 70: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

-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

)2

sin(

)2

sin()(

N

WR

20N

return

N2

N2

Page 71: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

-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

frequency in pi units

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

0

500

1000

1500

2000

frequency in pi units

)(RW

)(H

return

20N)(dH 5.0c

Page 72: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

-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

frequency in pi units

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

0

500

1000

1500

2000

frequency in pi units

)(RW

)(H

5.0 ,20 cN

Page 73: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

0

500

1000

1500

2000

Amplitude response

frequency in pi units

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

0

500

1000

1500

2000

Magnitude response

frequency in pi units

)(H

)( jeH

return

ps

ps

Page 74: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 5 10 15 20 250

0.2

0.4

0.6

0.8

1

Rectangular window: N=25

n-1 -0.5 0 0.5 10

5

10

15

20

25

Magnitude response

frequency in pi units

-1 -0.5 0 0.5 1

0

10

20

Amplitude response

frequency in pi units-1 -0.5 0 0.5 1

0

500

1000

1500

2000

Amplitude response of filter: wc=0.5pi

frequency in pi units

N4

N4

Page 75: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 5 10 15 20 250

0.2

0.4

0.6

0.8

1

Rectangular window: N=25

n-1 -0.5 0 0.5 1

-40

-30

-20

-10

0

Magnitude response

frequency in pi units

dB

-1 -0.5 0 0.5 1

0

10

20

Amplitude response

frequency in pi units-1 -0.5 0 0.5 1

-50

-40

-30

-20

-10

0

Magnitude response of filter: wc=0.5pi

frequency in pi units

dB

return

N

8.1

Page 76: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

-1 -0.5 0 0.5 1

0

500

1000

1500

2000

N = 7

frequency in pi units-1 -0.5 0 0.5 1

0

500

1000

1500

2000

N = 21

frequency in pi units

-1 -0.5 0 0.5 1

0

500

1000

1500

2000

N = 51

frequency in pi units-1 -0.5 0 0.5 1

0

500

1000

1500

2000

N = 101

frequency in pi units

Gibbs

Page 77: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

Page 78: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUCreturn

(a) (b)

Page 79: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 10 20 300

0.2

0.4

0.6

0.8

1

Triangular window: N=35

n-1 -0.5 0 0.5 1

-60

-40

-20

0

Magnitude response

frequency in pi units

dB

-1 -0.5 0 0.5 1

0

5

10

15

20Amplitude response

frequency in pi units-1 -0.5 0 0.5 1

-40

-30

-20

-10

0

Magnitude response of filter: wc=0.5pi

frequency in pi units

dB

return

N

8 N

2.4

Page 80: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 10 20 300

0.2

0.4

0.6

0.8

1

Hanning window: N=35

n-1 -0.5 0 0.5 1

-60

-40

-20

0

Magnitude response

frequency in pi units

dB

-1 -0.5 0 0.5 10

5

10

15

Amplitude response

frequency in pi units-1 -0.5 0 0.5 1

-60

-40

-20

0

Magnitude response of filter: wc=0.5pi

frequency in pi units

dB

return

N

8 N

2.6

Page 81: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 10 20 300

0.2

0.4

0.6

0.8

1

Hamming window: N=35

n-1 -0.5 0 0.5 1

-60

-40

-20

0

Magnitude response

frequency in pi units

dB

-1 -0.5 0 0.5 10

5

10

15

20Amplitude response

frequency in pi units-1 -0.5 0 0.5 1

-60

-40

-20

0

Magnitude response of filter: wc=0.5pi

frequency in pi units

dB

return

N

8 N

6.6

Page 82: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 10 20 300

0.2

0.4

0.6

0.8

1

Blackman window: N=35

n-1 -0.5 0 0.5 1

-80

-60

-40

-20

0

Magnitude response

frequency in pi units

dB

-1 -0.5 0 0.5 1

0

5

10

15

Amplitude response

frequency in pi units-1 -0.5 0 0.5 1

-80

-60

-40

-20

0

Magnitude response of filter: wc=0.5pi

frequency in pi units

dB

return

N

12N

11

Page 83: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

-10 0 100

0.2

0.4

0.6

0.8

1

Kaiser window: N=35,beta=7.865

n-1 -0.5 0 0.5 1

-100

-80

-60

-40

-20

0

Magnitude response

frequency in pi units

dB

-1 -0.5 0 0.5 1

0

5

10

15

20Amplitude response

frequency in pi units-1 -0.5 0 0.5 1

-100

-80

-60

-40

-20

0

Magnitude response of filter: wc=0.5pi

frequency in pi units

dB N

10

Page 84: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

-10 0 100

0.2

0.4

0.6

0.8

1

Kaiser window: N=35,beta=9.5

n-1 -0.5 0 0.5 1

-100

-80

-60

-40

-20

0

Magnitude response

frequency in pi units

dB

-1 -0.5 0 0.5 1

0

5

10

15

20Amplitude response

frequency in pi units-1 -0.5 0 0.5 1

-100

-80

-60

-40

-20

0

Magnitude response of filter: wc=0.5pi

frequency in pi units

dB

return

Page 85: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 5 10 15 20 25 30

0

0.1

0.2

0.3

Ideal Impulse Response

n 0 5 10 15 20 25 300

0.2

0.4

0.6

0.8

1

Hamming Window

n

0 5 10 15 20 25 30

0

0.1

0.2

0.3

Actual Impulse Response

n 0 0.2 0.4 0.6 0.8 1-100

-80

-60

-40

-20

0Magnitude Response in dB

pi

dB

33N

return

Page 86: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 5 10 15 20 25 30

0

0.1

0.2

0.3

Ideal Impulse Response

n 0 5 10 15 20 25 300

0.2

0.4

0.6

0.8

1

Hamming Window

n

0 5 10 15 20 25 30

0

0.1

0.2

0.3

Actual Impulse Response

n 0 0.2 0.4 0.6 0.8 1-100

-80

-60

-40

-20

0Magnitude Response in dB

pi

dB

34N

return

Page 87: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 10 20 30 40 50-0.4

-0.2

0

0.2

0.4

0.6Ideal Impulse Response

n 0 10 20 30 40 500

0.2

0.4

0.6

0.8

1

Blackman Window

n

0 10 20 30 40 50-0.4

-0.2

0

0.2

0.4

0.6Actual Impulse Response

n 0 0.2 0.4 0.6 0.8 1-120

-100

-80

-60

-40

-20

0Magnitude Response in dB

pi

dB

55N

return

Page 88: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUCreturn

1s 1p 2p 2s

pR

sA

0 2.0)(

35.0 65.0 8.0

dB 60

dB 1

1

Page 89: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 20 40 60

-0.2

-0.1

0

0.1

0.2

0.3

Ideal Impulse Response

n 0 20 40 600

0.2

0.4

0.6

0.8

1

Blackman Window

n

0 10 20 30 40 50 60 70

-0.2

-0.1

0

0.1

0.2

0.3

Actual Impulse Response

n 0 0.2 0.4 0.6 0.8 1

-100

-80

-60

-40

-20

0Magnitude Response in dB

pi

dB

74N

return

Page 90: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUCreturn

1s1p 2p2s

pR

sA

0 3.0)(

4.0 6.0 7.0

dB 40

dB .50

1

Page 91: Copyright © 2005. Shi Ping CUC Chapter 8 FIR Filter Design Content Introduction Properties of Linear-Phase FIR Filters Window Design Techniques

Copyright © 2005. Shi Ping CUC

0 10 20 30 40 50 60-0.2

0

0.2

0.4

0.6

0.8Ideal Impulse Response

n 0 10 20 30 40 50 600

0.2

0.4

0.6

0.8

1

Hanning Window

n

0 10 20 30 40 50 60-0.2

0

0.2

0.4

0.6

0.8Actual Impulse Response

n 0 0.2 0.4 0.6 0.8 1-70

-60

-50

-40

-30

-20

-10

0Magnitude Response in dB

pi

dB

63N

return