Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310...

24
BME 310 Biomedical Computing - J.Schesser 249 Frequency Response of FIR Filters Lecture #10 Chapter 6

Transcript of Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310...

Page 1: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

249

Frequency Response of FIR Filters

Lecture #10 Chapter 6

Page 2: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

250

Properties of the Frequency Response •  Relationship of the Frequency Response to the Difference

Equation and Impulse Response

s' theknowingby responsefrequency theand response impulse equation, difference ebetween th Go

DomainFrequency Domain Time

][)(][][

)()(][][][

ResponseFrequency Equation Difference

][][][][

Response Impulse Equation Difference

0

ˆ

0

ˆˆ

0

ˆˆˆ

0

ˆ

0

00

k

M

k

kjM

k

kjk

jM

kk

njjjnjjM

k

kjk

M

kk

M

kk

M

kk

b

ekhebeHknbnh

eAeeHeAeebnyknxbny

knbnhknxbny

==⇔−=

==⇔−=

−=⇔−=

∑∑∑

∑∑

∑∑

=

=

=

=

=

==

ωωω

ωφωωφω

δ

δ

Page 3: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

251

Example

ωωω

δδδ

ˆ2ˆˆ 31)(]2[]1[3][][

}1 ,3 ,1{}{]2[]1[3][][

jjj

k

eeeHnxnxnxny

bnnnnh

−− −+−=−−−+−=

−−=−−−+−=

Page 4: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

252

Periodicity of the Frequency Response

•  The Frequency Response is a periodic function of 2π

πωπ

ω

π

ω

πω

πωπω

<<

===

=

=

=

−−

=

+−+

ˆ- e.g., period, oneover )( express always weTherefore,

1 when 1 since )(

)(

ˆ

2

ˆ0

0

)2ˆ()2ˆ(

j

kj

j

M

k

kjkjk

M

k

kjk

j

eHke

eH

eeb

ebeH

Page 5: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

253

Conjugate Symmetry

•  If the filter coefficients are real (i.e., bk=bk*), then the frequency response has conjugate symmetry and

•  As a result, –  In polar form, the magnitude is an even function and the

phase is an odd function –  In Cartesian form, the real part is an even function and the

imaginary part is an odd function

•  Therefore, we only have to show the frequency for one half of a period, (e.g., between 0 and π)

)(*)( ˆˆ ωω jj eHeH =−

Page 6: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

254

Proof of Conjugate Symmetry

)(

*

)(*

ˆ0

)ˆ(

0

ˆ

0

ˆˆ*

ω

ω

ω

ωω

j

M

k

kjk

M

k

kjk

M

k

kjk

j

eH

eb

eb

ebeH

=

−−

=

+

=

=

=

=

⎟⎠⎞⎜

⎝⎛=

Page 7: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

255

Proof of Conjugate Symmetry

function odd )()(

functioneven )()(

)(

)(*

)()(

)()(

ˆˆ

ˆˆ

)(ˆ

)*(ˆ

)(ˆˆ

)(ˆˆ

ˆ

ˆ

ˆ

ˆ

ωω

ωω

ω

ω

ωω

ωω

ω

ω

ω

ω

jj

jj

eHjj

eHjj

eHjjj

eHjjj

eHeH

eHeH

eeH

eeH

eeHeH

eeHeH

j

j

j

j

−∠=∠

=

=

=

=

=

∠−

∠−−

Page 8: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

256

Proof of Conjugate Symmetry

function odd )]([)]([functioneven )]([)]([

)]([)]([)](*[)](*[

)]([)]([)()]([)]([)(

ˆˆ

ˆˆ

ˆˆ

ˆˆ

ˆˆˆ

ˆˆˆ

ωω

ωω

ωω

ωω

ωωω

ωωω

jj

jj

jj

jj

jjj

jjj

eHmeHmeHeeHe

eHmjeHeeHmjeHe

eHmjeHeeHeHmjeHeeH

−ℑ=ℑℜ=ℜ

ℑ−ℜ=ℑ+ℜ=ℑ+ℜ=ℑ+ℜ=

−−−

Page 9: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

257

Graphical Representation of the Frequency Response

•  The frequency response varies with frequency •  By choosing the coefficients of the difference

equation, the shape of the frequency response vs frequency can be developed.

•  Examples are: –  filters which only pass low frequencies –  filters which only pass high frequencies –  filters which only alter the phase

•  Therefore, we usually plot the amplitude and phase of the frequency response vs. frequency –  This is sometimes called the Bode Plot

Page 10: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

258

Delay System

•  A simple FIR filter: y[n]=x[n-n0] •  Therefore, from the difference equation, k = n0

and bn0=1 and the Frequency Response

becomes: 0ˆˆ )( njj eeH ωω −=

0ˆ ˆ)( neH j ωω −=∠

Page 11: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

259

First-Difference System High Pass Filter

0

0.5

1

1.5

2

2.5

-4 -3 -2 -1 0 1 2 3 4

2/)ˆ()(2ˆ

sin2)(

)2/ˆsin(2)2/ˆsin(2

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

]1[][][

ˆ

ˆ

2/)ˆ(

2/ˆ2/

2/ˆ

2/ˆ2/ˆ2/ˆˆˆ

πω

ωωω

ω

ω

ω

πω

ωπ

ω

ωωωωω

−−=∠

=

===

−=−=−−=

−−

−−−

j

j

j

jj

j

jjjjj

eH

eH

eee

jeeeeeeH

nxnxny

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

-4 -3 -2 -1 0 1 2 3 4

Page 12: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

260

Simple Low Pass Filter

ω

ωω

ω

ω

ω

ωωω

ωωω

ˆ)(

)ˆcos22()(

)ˆcos22()2(

21)(]2[]1[2][][

ˆ

ˆ

ˆ

ˆˆˆ

ˆ2ˆˆ

−=∠

+=

+=++=

++=−+−+=

−−

−−

j

j

j

jjj

jjj

eH

eH

eeee

eeeHnxnxnxny

-4

-3

-2

-1

0

1

2

3

4

-4 -3 -2 -1 0 1 2 3 4

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

-4 -3 -2 -1 0 1 2 3 4

Page 13: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

261

Cascaded LTI Systems

•  Recall that two systems cascaded together, then the overall impulse response is the convolution of the two individual impulse responses.

•  It turns out the the frequency response of a cascaded system is the product of the individual frequency responses.

Page 14: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

262

Proof of the Frequency Response of Cascaded Systems

LTI 1

h1[n]

LTI 2

h2[n]

x[n]

y1[n] =

x2[n] y2[n] = y [n]

δ[n] h1 [n] h2 [n] h1 [n]

)()(][][related are processes theseTherefore,

)()()(

)()(][)(][][

)(][

ˆ1

ˆ221

ˆ1

ˆ2

ˆ

ˆˆ1

ˆ21

ˆ22

ˆˆ11

ωω

ωωω

ωωωω

ωω

jj

jjjT

njjjj

njj

eHeHnhnh

eHeHeHeeHeHnyeHnyny

eeHny

⇔⊗

=

===

=�

Page 15: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

263

Running-Average Filtering •  A simple LTI system defined as the L-point running

average

•  The frequency response is then

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

][1][1

0

−−+−+=

−= ∑−

=

LnxnxnxL

knxL

nyL

k

∑−

=

−=1

0

ˆˆ 1)(L

k

kjj eL

eH ωω

Page 16: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

264

The Frequency Response of the Running Average Filter

2)1(ˆ

2ˆ2ˆ2ˆ

2ˆ2ˆ2ˆ

ˆ

ˆ1

0

ˆˆ

1

0

1

0

ˆˆ

)2ˆsin2ˆsin)(1(

))(

)()(1(

)11)(1(1)(

11

series geometric a of sums partial for the formula theUsing

1)(

−−

−+−

−+−

−−

=

=

=

=

−−=

−−==

−−=

=

Lj

jjj

LjLjLj

j

LjL

k

kjj

L

k

Lk

L

k

kjj

eLL

eeeeee

L

ee

Le

LeH

eL

eH

ω

ωωω

ωωω

ω

ωωω

ωω

ωω

ααα

FunctionDirichlet 2ˆsin2ˆsin)(

)()(Therefore,

ˆ

2)1(ˆˆˆ

⇐=

= −−

ωωω

ωωω

LLeD

eeDeH

jL

LjjL

j

Page 17: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

265

Plot of the Dirichlet Function

-1

0

1

-3.14 -1.57 0 1.57 3.14

1)2()2(

)2ˆ)(cos21(lim

)2ˆcos)(2(limˆ

2ˆsinlim

ˆ2ˆsinlim

2ˆsin2ˆsinlim)(lim

rule sHopital'L' Using

00

0sin0sin)(

0? ˆ when happensWhat

ˆ

0

===

==

==

=

→→

LL

L

LLd

dLdLd

LLeD

LeD

jL

jL

ω

ωωω

ωω

ωω

ω

ω

ω

ω

ω

ω

ω

ω

•  Properties of : –  Even Function and periodic in 2π –  Maximum at 0 –  Has zeroes at integer multiples of 2π / L

•  Low Pass Filter

)( ω̂jL eD

Page 18: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

266

Smoothing an Image

•  See Figures 6-11 through 6-15 for example of the application of the running average filter.

Page 19: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

267

Reconstruction of a Continuous-time signal

•  Recall: –  The sampling theorem suggests that a process exists for

reconstructing a continuous-time signal from its samples. –  If we know the sampling rate and know its spectrum then we

can reconstruct the continuous-time signal by scaling the principal alias of the discrete-time signal to the frequency of the continuous signal.

–  The principal alias will always be in the range between 0 ~ π if the sampling rate is greater than the Nyquist rate.

Page 20: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

268

Continued •  If continuous-time signal has a frequency of ω, then the discrete-

time signal will have a principal alias of

•  So we can use this equation to determine the frequency of the continuous-time signal from the principal alias:

•  Note that the principal alias must be less than p if the Nyquist rate is used

•  And the reconstructed continuous-time frequency must be

s

s fT ωωω ==ˆ

s

s Tf ωωω ˆˆ ==

ππππωω ≤≥

====)2(

222ˆMAXs

MAX

s

MAXsMAXsMAX ff

fffTfT

222ˆˆ2 sss

s

ffffff =≤=⇒==ππ

πωωπω

Page 21: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

269

Low Pass Filter •  Since we are within the Nyquist rate, the principal alias is < π

•  Best reconstruction is Low Pass Filter or what the text calls: Ideal Bandlimited Interpolation

0.4π 1.6π 2.4π -0.4π -1.6π -2.4π

0.5

Page 22: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

270

Reconstruction of a Continuous-time signal in terms of the Frequency Response

ˆ

ˆ ˆ

( ) Continuous-Time Signal[ ] Sampled Continuous-Time Signal

Ideal C-to-D conversion2ˆ

[ ] ( ) Applying the a f

s

j t

j nT j n

ss

j j n

x t Xex n Xe Xe

fTf

y n H e Xe

ω

ω ω

ω ω

πω ω

= ⇐

= = ⇐⇐

= =

= ⇐ ilter to recover the signal ( )

( ) ( ) Ideal D-to-C conversion only good for -

ˆ since for -

s s

s

j T j T n

j T j t

s s

H e Xey t H e Xe

T T

ω ω

ω ω

π ω ππ ω

=

= ⇐⇐ < <⇐ < to obtain the principal aliasπ<

Page 23: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

271

Example

Signal tedReconstruc )2)250(2cos(0909.0 )4)25(2cos(8811.)(

250 at FR 0909.00909.0)1000)250((sin11)1000)11)(250(sin(

)2/1000)250(2(sin11)2/111000)250(2sin()(

25 at FR 8811.0)1000)25((sin11)1000)11)(25(sin(

)2/1000)25(2(sin11)2/111000)25(2sin()(

)(

1000 for FR )()()(

1000 Signal Analog ))250(2cos())25(2cos()(

ResponseFrequency Its 2/ˆsin112/11ˆsin)(

filterpoint -11 ][111][

2/)2/2(

100)250(

51000)250(21000)250(2

4

1000)25(

51000)25(21000)25(2

10002

1000ˆ

5ˆˆ

10

0

⇐−+−=

=⇐==

=

×=

=⇐=

=

×=

=

=⇐==

=⇐+=

⇐=

⇐−=

−+−

×−

×−

=∑

ππππ

ππ

ππ

ππ

ππ

ππ

ωω

πππ

π

ππ

π

π

ππ

π

ωωω

ωω

ttty

fee

e

eeH

fe

e

eeH

eHfeHeHeH

ftttx

eeH

knxny

jj

j

jj

j

j

jj

fjs

jTjj

s

jj

k

s

-1

0

1

-300 -250 -200 -150 -100 -50 0 50 100 150 200 250 300

Page 24: Frequency Response of FIR Filtersjoelsd/Fundamentals/coursework/BME... · 2013-03-31 · BME 310 Biomedical Computing - J.Schesser 253 Conjugate Symmetry • If the filter coefficients

BME 310 Biomedical Computing - J.Schesser

272

Homework

•  Exercises: –  6.2-6.6

•  Problems: –  6.14 Use Matlab to plot the Frequency Response; show

your code –  6.15 –  6.17, 6.19, Use Matlab to plot the Frequency Response;

show your code –  6.20, 6.21