Signal Processing First Lecture Slides

September 25, 2017 | Author: cfsenel | Category: N/A
Share Embed Donate


Short Description

Download Signal Processing First Lecture Slides...

Description

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Chapter 2, pp. 9-17

LECTURE #1 Sinusoids

ƒ Appendix A: Complex Numbers ƒ Appendix B: MATLAB ƒ Chapter 1: Introduction

4/3/2006

CONVERGING FIELDS Math

3

COURSE OBJECTIVE ƒ Students will be able to: ƒ Understand mathematical descriptions of signal processing algorithms and express those algorithms as computer implementations (MATLAB)

Physics

EE CmpE Computer Science

© 2003-2006, JH McClellan & RW Schafer

Applications

ƒ What are your objectives?

BIO 4/3/2006

© 2003-2006, JH McClellan & RW Schafer

4

4/3/2006

© 2003-2006, JH McClellan & RW Schafer

5

WHY USE DSP ?

Fourier Everywhere

ƒ Mathematical abstractions lead to generalization and discovery of new processing techniques

ƒ Telecommunications ƒ Sound & Music ƒ CDROM, Digital Video

ƒ Fourier Optics ƒ X-ray Crystallography ƒ Protein Structure & DNA

ƒ Computer implementations are flexible

ƒ Computerized Tomography ƒ Nuclear Magnetic Resonance: MRI ƒ Radioastronomy

ƒ Applications provide a physical context

ƒ Ref: Prestini, “The Evolution of Applied Harmonic Analysis” 4/3/2006

© 2003-2006, JH McClellan & RW Schafer

6

4/3/2006

© 2003-2006, JH McClellan & RW Schafer

LECTURE OBJECTIVES

TUNING FORK EXAMPLE

ƒ Write general formula for a “sinusoidal” waveform, or signal ƒ From the formula, plot the sinusoid versus time

ƒ ƒ ƒ ƒ ƒ

ƒ What’s a signal?

CD-ROM demo “A” is at 440 Hertz (Hz) Waveform is a SINUSOIDAL SIGNAL Computer plot looks like a sine wave This should be the mathematical formula:

A cos(2π ( 440)t + ϕ )

ƒ It’s a function of time, x(t) ƒ in the mathematical sense 4/3/2006

© 2003-2006, JH McClellan & RW Schafer

7

8

4/3/2006

© 2003-2006, JH McClellan & RW Schafer

9

TUNING FORK A-440 Waveform T ≈ 8.15 − 5.85 = 2.3 ms

ƒ Break x(t) into its sinusoidal components

f = 1/ T

ƒ Called the FREQUENCY SPECTRUM

= 1000 / 2.3 ≈ 435 Hz

ƒ More complicated signal (BAT.WAV) ƒ Waveform x(t) is NOT a Sinusoid ƒ Theory will tell us ƒ x(t) is approximately a sum of sinusoids ƒ FOURIER ANALYSIS

Time (sec)

4/3/2006

SPEECH EXAMPLE

© 2003-2006, JH McClellan & RW Schafer

10

4/3/2006

© 2003-2006, JH McClellan & RW Schafer

Speech Signal: BAT

DIGITIZE the WAVEFORM

ƒ Nearly Periodic in Vowel Region

ƒ x[n] is a SAMPLED SINUSOID

ƒ Period is (Approximately) T = 0.0065 sec

11

ƒ A list of numbers stored in memory

ƒ Sample at 11,025 samples per second ƒ Called the SAMPLING RATE of the A/D ƒ Time between samples is ƒ 1/11025 = 90.7 microsec

ƒ Output via D/A hardware (at Fsamp) 4/3/2006

© 2003-2006, JH McClellan & RW Schafer

12

4/3/2006

© 2003-2006, JH McClellan & RW Schafer

13

STORING DIGITAL SOUND

SINES and COSINES

ƒ x[n] is a SAMPLED SINUSOID

ƒ Always use the COSINE FORM

ƒ A list of numbers stored in memory

ƒ ƒ ƒ ƒ

A cos(2π ( 440)t + ϕ )

CD rate is 44,100 samples per second 16-bit samples Stereo uses 2 channels Number of bytes for 1 minute is

ƒ Sine is a special case:

sin(ω t ) = cos(ω t − π2 )

ƒ 2 X (16/8) X 60 X 44100 = 10.584 Mbytes 4/3/2006

14

© 2003-2006, JH McClellan & RW Schafer

SINUSOIDAL SIGNAL

ω

ƒ Radians/sec ƒ Hertz (cycles/sec)

ƒ AMPLITUDE ƒ Magnitude

ω = (2π ) f

ƒ PERIOD (in sec)

T= 4/3/2006

1 2π = f ω

ƒ PHASE

© 2003-2006, JH McClellan & RW Schafer

© 2003-2006, JH McClellan & RW Schafer

15

EXAMPLE of SINUSOID

A cos(ω t + ϕ ) ƒ FREQUENCY

4/3/2006

ƒ Given the Formula

A

ƒ Make a plot

5 cos(0.3π t + 1.2π )

ϕ 16

4/3/2006

© 2003-2006, JH McClellan & RW Schafer

17

PLOTTING COSINE SIGNAL from the FORMULA

PLOT COSINE SIGNAL

5 cos(0.3π t + 1.2π )

5cos(0.3π t +12 . π)

ƒ Determine period:

ƒ Formula defines A, ω, and φ

T = 2π / ω = 2π / 0.3π = 20 / 3

A=5

ƒ Determine a peak location by solving

ω = 0.3π ϕ = 1.2π 4/3/2006

© 2003-2006, JH McClellan & RW Schafer

(ω t + ϕ ) = 0 ⇒ (0.3π t + 1.2π ) = 0 ƒ Zero crossing is T/4 before or after ƒ Positive & Negative peaks spaced by T/2 18

PLOT the SINUSOID

5 cos(0.3π t + 1.2π ) ƒ Use T=20/3 and the peak location at t=-4

← " 203 " →

4/3/2006

© 2003-2006, JH McClellan & RW Schafer

20

4/3/2006

© 2003-2006, JH McClellan & RW Schafer

19

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Chapter 2, Sects. 2-3 to 2-5

LECTURE #2 Phase & Time-Shift Complex Exponentials

ƒ Appendix A: Complex Numbers ƒ Appendix B: MATLAB ƒ Next Lecture: finish Chap. 2, ƒ Section 2-6 to end

8/22/2003

8/22/2003

1

© 2003, JH McClellan & RW Schafer

LECTURE OBJECTIVES

SINUSOIDAL SIGNAL

A cos(ω t + ϕ ) ƒ FREQUENCY ω ƒ AMPLITUDE A ƒ Radians/sec

ƒ Define Sinusoid Formula from a plot ƒ Relate TIME-SHIFT to PHASE Introduce an ABSTRACTION: Complex Numbers represent Sinusoids Complex Exponential Signal

z (t ) = Xe 8/22/2003

© 2003, JH McClellan & RW Schafer

3

© 2003, JH McClellan & RW Schafer

ƒ or, Hertz (cycles/sec)

ƒ Magnitude

ω = ( 2π ) f

jωt

ƒ PERIOD (in sec)

T= 4

8/22/2003

1 2π = ω f

ƒ PHASE

© 2003, JH McClellan & RW Schafer

ϕ 5

PLOTTING COSINE SIGNAL from the FORMULA

ANSWER for the PLOT

5 cos(0.3π t + 1.2π )

5 cos(0.3π t + 1.2π )

ƒ Determine period:

ƒ Use T=20/3 and the peak location at t=-4

T = 2π / ω = 2π / 0.3π = 20 / 3 ƒ Determine a peak location by solving

← " 20 "→ 3

(ω t + ϕ ) = 0 ƒ Peak at t=-4 8/22/2003

© 2003, JH McClellan & RW Schafer

6

TIME-SHIFT

8/22/2003

© 2003, JH McClellan & RW Schafer

7

TIME-SHIFTED SINUSOID x (t + 4) = 5 cos(0.3π (t + 4)) = 5 cos(0.3π (t − ( −4))

ƒ In a mathematical formula we can replace t with t-tm

x (t − tm ) = A cos(ω (t − tm ))

ƒ Then the t=0 point moves to t=tm ƒ Peak value of cos(ω(t-tm)) is now at t=tm 8/22/2003

© 2003, JH McClellan & RW Schafer

8

8/22/2003

© 2003, JH McClellan & RW Schafer

9

PHASE TIME-SHIFT

SINUSOID from a PLOT

ƒ Equate the formulas:

ƒ Measure the period, T

A cos(ω (t − tm )) = A cos(ω t + ϕ ) − ω tm = ϕ

ƒ and we obtain: ƒ or,

tm = −0.00125 sec 8/22/2003

3 steps

ƒ Compute phase: φ = -ω tm

ƒ Measure height of positive peak: A 10

© 2003, JH McClellan & RW Schafer

ω=

2π T

=

8/22/2003

© 2003, JH McClellan & RW Schafer

11

SINE DRILL (MATLAB GUI)

(A, ω, φ) from a PLOT

.01sec 1 T = 10period = 100

ƒ Compute frequency: ω = 2π/T

ƒ Measure time of a peak: tm

ϕ tm = − ω

8/22/2003

ƒ Between peaks or zero crossings

2π 0.01

= 200π

ϕ = −ω tm = −(200π )(tm ) = 0.25π © 2003, JH McClellan & RW Schafer

12

8/22/2003

© 2003, JH McClellan & RW Schafer

13

PHASE is AMBIGUOUS

COMPLEX NUMBERS

ƒ The cosine signal is periodic

ƒ To solve: z2 = -1

ƒ Period is 2π

A cos(ω t + ϕ + 2π ) = A cos(ω t + ϕ )

ƒ Thus adding any multiple of 2π leaves x(t) unchanged

if tm = tm 2 = 8/22/2003

−ϕ

ƒ Complex number: z = x + j y y

z

, then

ω − (ϕ + 2π ) ω

=

−ϕ

ω





ω

= tm − T

© 2003, JH McClellan & RW Schafer

© 2003, JH McClellan & RW Schafer

Cartesian coordinate system

x

14

8/22/2003

© 2003, JH McClellan & RW Schafer

15

COMPLEX ADDITION = VECTOR Addition

PLOT COMPLEX NUMBERS

8/22/2003

ƒz=j ƒ Math and Physics use z = i

16

8/22/2003

z3 = z1 + z2 = (4 − j 3) + (2 + j5) = (4 + 2) + j ( −3 + 5) = 6 + j2

© 2003, JH McClellan & RW Schafer

17

*** POLAR FORM ***

POLAR RECTANGULAR

ƒ Vector Form

ƒ Relate (x,y) to (r,θ)

ƒ Length =1 ƒ Angle = θ

2

r =x +y

ƒ Common Values

θ=

ƒ j has angle of 0.5π ƒ −1 has angle of π ƒ − j has angle of 1.5π ƒ also, angle of −j could be −0.5π = 1.5π −2π ƒ because the PHASE is AMBIGUOUS 8/22/2003

© 2003, JH McClellan & RW Schafer

θ

()

y Tan −1 x

y x

x = r cosθ y = r sin θ

Need a notation for POLAR FORM 18

8/22/2003

© 2003, JH McClellan & RW Schafer

19

COMPLEX EXPONENTIAL

e jω t = cos(ω t ) + j sin(ω t )

ƒ Complex Exponential ƒ Real part is cosine ƒ Imaginary part is sine ƒ Magnitude is one

ƒ Interpret this as a Rotating Vector ƒ ƒ ƒ ƒ

e jθ = cos(θ ) + j sin(θ ) re jθ = r cos(θ ) + jr sin(θ ) © 2003, JH McClellan & RW Schafer

2

Most calculators do Polar-Rectangular

Euler’s FORMULA

8/22/2003

2

r

θ = ωt ω Angle changes vs. time ex: ω=20π rad/s Rotates 0.2π in 0.01 secs jθ

e

20

8/22/2003

= cos(θ ) + j sin(θ )

© 2003, JH McClellan & RW Schafer

21

cos = REAL PART Real Part of Euler’s General Sinusoid So,

REAL PART EXAMPLE

cos(ω t ) = ℜe{ e

jω t

}

Evaluate:

x (t ) = A cos(ω t + ϕ )

Answer:

A cos(ω t + ϕ ) = ℜe{ Ae j (ω t +ϕ ) }

{

COMPLEX AMPLITUDE General Sinusoid

{

x(t ) = A cos(ω t + ϕ ) = ℜe Ae jϕ e jωt

}

Complex AMPLITUDE = X

z (t ) = Xe jωt

X = Ae jϕ

Then, any Sinusoid = REAL PART of Xejωt

{

}

{

x(t ) = ℜe Xe jωt = ℜe Ae jϕ e jωt 8/22/2003

© 2003, JH McClellan & RW Schafer

{

}

}

}

}

= ℜe 3e − j 0.5π e jω t = 3 cos(ω t − 0.5π ) 22

© 2003, JH McClellan & RW Schafer

{

x (t ) = ℜe − 3 je jω t

x (t ) = ℜe ( −3 j )e jω t

= ℜe{ Ae jϕ e jω t } 8/22/2003

{

A cos(ω t + ϕ ) = ℜe Ae jϕ e jω t

}

24

8/22/2003

© 2003, JH McClellan & RW Schafer

23

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Chapter 2, Section 2-6

LECTURE #3 Phasor Addition Theorem

1/12/2004

© 2003, JH McClellan & RW Schafer

ƒ Other Reading: ƒ Appendix A: Complex Numbers ƒ Appendix B: MATLAB ƒ Next Lecture: start Chapter 3

1/12/2004

1

© 2003, JH McClellan & RW Schafer

3

Z DRILL (Complex Arith)

LECTURE OBJECTIVES ƒ Phasors = Complex Amplitude ƒ Complex Numbers represent Sinusoids

z (t ) = Xe jωt = ( Ae jϕ )e jωt ƒ Develop the ABSTRACTION: ƒ Adding Sinusoids = Complex Addition

ƒ PHASOR ADDITION THEOREM 1/12/2004

© 2003, JH McClellan & RW Schafer

4

1/12/2004

© 2003, JH McClellan & RW Schafer

5

AVOID Trigonometry

Euler’s FORMULA

ƒ Algebra, even complex, is EASIER !!! ƒ Can you recall cos(θ1+θ2) ? ƒ Use: real part of ej(θ1+θ2) = cos(θ +θ ) 1

ƒ Complex Exponential ƒ Real part is cosine ƒ Imaginary part is sine ƒ Magnitude is one

2

e j (θ1 +θ 2 ) = e jθ1 e jθ 2 = (cosθ1 + j sin θ1 )(cosθ 2 + j sin θ 2 ) = (cosθ1 cosθ 2 − sin θ1 sin θ 2 ) + j (...) 1/12/2004

© 2003, JH McClellan & RW Schafer

6

Real & Imaginary Part Plots

e jθ = cos(θ ) + j sin(θ )

e jωt = cos(ω t ) + j sin(ω t ) 1/12/2004

© 2003, JH McClellan & RW Schafer

7

COMPLEX EXPONENTIAL

e jω t = cos(ω t ) + j sin(ω t ) ƒ Interpret this as a Rotating Vector PHASE DIFFERENCE

ƒ ƒ ƒ ƒ

= π/2

θ = ωt ω Angle changes vs. time ex: ω=20π rad/s Rotates 0.2π in 0.01 secs

e jθ = cos(θ ) + j sin(θ ) 1/12/2004

© 2003, JH McClellan & RW Schafer

8

1/12/2004

© 2003, JH McClellan & RW Schafer

9

Rotating Phasor

Cos = REAL PART Real Part of Euler’s

See Demo on CD-ROM Chapter 2

General Sinusoid

cos(ω t) = ℜe{e jω t }

x(t) = Acos(ω t + ϕ ) So,

A cos(ω t + ϕ ) = ℜe{Ae j (ω t +ϕ ) } = ℜe{Ae jϕ e jω t }

1/12/2004

10

© 2003, JH McClellan & RW Schafer

1/12/2004

11

© 2003, JH McClellan & RW Schafer

COMPLEX AMPLITUDE

POP QUIZ: Complex Amp

General Sinusoid

ƒ Find the COMPLEX AMPLITUDE for:

x(t) = Acos(ω t + ϕ ) = ℜe{Ae jϕ e jω t } Sinusoid = REAL PART of (Aejφ)ejωt

x(t) = ℜe {Xe

jω t

x(t ) = 3 cos(77π t + 0.5π ) ƒ Use EULER’s FORMULA:

{ = ℜe{ 3e

x(t ) = ℜe 3e j ( 77π t +0.5π )

}= ℜe{z(t)}

Complex AMPLITUDE = X

z(t) = Xe 1/12/2004

jω t

© 2003, JH McClellan & RW Schafer

X = Ae

jϕ 12

1/12/2004

j 0.5π

X = 3e j 0.5π © 2003, JH McClellan & RW Schafer

e j 77π t

} } 13

WANT to ADD SINUSOIDS

ADD SINUSOIDS

ƒ ALL SINUSOIDS have SAME FREQUENCY ƒ HOW to GET {Amp,Phase} of RESULT ?

ƒ Sum Sinusoid has SAME Frequency

1/12/2004

1/12/2004

© 2003, JH McClellan & RW Schafer

14

PHASOR ADDITION RULE

© 2003, JH McClellan & RW Schafer

15

Phasor Addition Proof

Get the new complex amplitude by complex addition

1/12/2004

© 2003, JH McClellan & RW Schafer

16

1/12/2004

© 2003, JH McClellan & RW Schafer

17

POP QUIZ: Add Sinusoids

POP QUIZ (answer)

ƒ ADD THESE 2 SINUSOIDS:

ƒ COMPLEX ADDITION:

x1 (t ) = cos(77π t )

j 3 = 3e

x2 (t ) = 3 cos(77π t + 0.5π )

1e j 0 + 3e j 0.5π © 2003, JH McClellan & RW Schafer

j 0.5π

1 ƒ CONVERT back to cosine form:

ƒ COMPLEX ADDITION:

1/12/2004

1 + j 3 = 2e jπ / 3

x3 (t ) = 2 cos(77π t + π3 ) 18

ADD SINUSOIDS EXAMPLE

1/12/2004

© 2003, JH McClellan & RW Schafer

19

Convert Time-Shift to Phase

x1 (t ) tm1

ƒ Measure peak times: ƒ tm1=-0.0194, tm2=-0.0556, tm3=-0.0394

ƒ Convert to phase (T=0.1)

x2 (t )

ƒ φ1=-ω ωtm1 = -2π π(tm1 /T) = 70π/180, ƒ φ2= 200π/180

tm2

ƒ Amplitudes

x3 (t ) = x1 (t ) + x2 (t )

ƒ A1=1.7, A2=1.9, A3=1.532

tm3 1/12/2004

© 2003, JH McClellan & RW Schafer

20

1/12/2004

© 2003, JH McClellan & RW Schafer

21

Phasor Add: Numerical

ADD SINUSOIDS

ƒ Convert Polar to Cartesian ƒ X1 = 0.5814 + j1.597 ƒ X2 = -1.785 - j0.6498 ƒ sum = ƒ X3 = -1.204 + j0.9476

X1

ƒ Convert back to Polar

VECTOR (PHASOR) ADD

ƒ X3 = 1.532 at angle 141.79π/180 ƒ This is the sum 1/12/2004

© 2003, JH McClellan & RW Schafer

22

1/12/2004

X3

X2

© 2003, JH McClellan & RW Schafer

23

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Chapter 3, Section 3-1

Lecture 4 Spectrum Representation

ƒ Other Reading: ƒ Appendix A: Complex Numbers ƒ Next Lecture: Ch 3, Sects 3-2, 3-3, 3-7 & 3-8

8/31/2003

© 2003, JH McClellan & RW Schafer

8/31/2003

1

3

© 2003, JH McClellan & RW Schafer

LECTURE OBJECTIVES

FREQUENCY DIAGRAM

ƒ Sinusoids with DIFFERENT Frequencies

ƒ Plot Complex Amplitude vs. Freq

ƒ SYNTHESIZE by Adding Sinusoids

N

x (t ) = ∑ Ak cos(2π f k t + ϕ k )

4e − jπ / 2

k =1

ƒ SPECTRUM Representation

–250

7e

jπ / 3

–100

10

0

7e − jπ / 3

100

ƒ Graphical Form shows DIFFERENT Freqs 8/31/2003

© 2003, JH McClellan & RW Schafer

4

8/31/2003

© 2003, JH McClellan & RW Schafer

4e jπ / 2 250

f (in Hz)

5

Frequency is the vertical axis

Another FREQ. Diagram

8/31/2003

MOTIVATION

A-440

ƒ Synthesize Complicated Signals ƒ Musical Notes ƒ Piano uses 3 strings for many notes ƒ Chords: play several notes simultaneously

ƒ Human Speech ƒ Vowels have dominant frequencies ƒ Application: computer generated speech

ƒ Can all signals be generated this way? ƒ Sum of sinusoids?

Time is the horizontal axis

6

© 2003, JH McClellan & RW Schafer

Fur Elise WAVEFORM

© 2003, JH McClellan & RW Schafer

© 2003, JH McClellan & RW Schafer

7

Speech Signal: BAT ƒ Nearly Periodic in Vowel Region

Beat Notes

8/31/2003

8/31/2003

ƒ Period is (Approximately) T = 0.0065 sec

8

8/31/2003

© 2003, JH McClellan & RW Schafer

9

Euler’s Formula Reversed

INVERSE Euler’s Formula

ƒ Solve for cosine (or sine)

ƒ Solve for cosine (or sine)

e jω t = cos(ω t ) + j sin(ω t )

e

− jω t

cos(ω t ) = 12 (e jω t + e − jω t )

= cos( −ω t ) + j sin( −ω t )

e − jω t = cos(ω t ) − j sin(ω t ) e jω t + e − jω t = 2 cos(ω t )

sin(ω t ) =

cos(ω t ) = 12 (e jω t + e − jω t ) 8/31/2003

10

© 2003, JH McClellan & RW Schafer

8/31/2003

1 2j

(e jω t − e − jω t )

© 2003, JH McClellan & RW Schafer

SPECTRUM Interpretation

NEGATIVE FREQUENCY

ƒ Cosine = sum of 2 complex exponentials:

ƒ Is negative frequency real? ƒ Doppler Radar provides an example

A cos(7t ) =

A e j 7t 2

+ 2A e − j 7t

ƒ Police radar measures speed by using the Doppler shift principle ƒ Let’s assume 400Hz ÅÆ60 mph ƒ +400Hz means towards the radar ƒ -400Hz means away (opposite direction) ƒ Think of a train whistle

One has a positive frequency The other has negative freq. Amplitude of each is half as big

8/31/2003

© 2003, JH McClellan & RW Schafer

11

12

8/31/2003

© 2003, JH McClellan & RW Schafer

13

SPECTRUM of SINE

GRAPHICAL SPECTRUM EXAMPLE of SINE

ƒ Sine = sum of 2 complex exponentials: A sin(7t ) = 2Aj e j 7t − 2Aj e − j 7t = 12 Ae − j 0.5π e j 7t + 12 Ae j 0.5π e − j 7t −1 = j ƒ Positive freq. has phase = -0.5π ƒ Negative freq. has phase = +0.5π

8/31/2003

A sin(7t ) =

1 2

Ae − j 0.5π e j 7t + 12 Ae j 0.5π e − j 7t

( 12 A)e − j 0.5π

( 12 A)e j 0.5π

j = e j 0.5π -7

7

8/31/2003

15

© 2003, JH McClellan & RW Schafer

SPECTRUM ---> SINUSOID

Gather (A,ω,φ ω,φ) ω,φ information

ƒ Add the spectrum components:

ƒ Frequencies:

4e

− jπ / 2

–250

7e

jπ / 3

–100

10 7e

0

− jπ / 3

100

ƒ ƒ ƒ ƒ ƒ

4e jπ / 2 250

© 2003, JH McClellan & RW Schafer

-250 Hz -100 Hz 0 Hz 100 Hz 250 Hz

ƒ Amplitude & Phase ƒ ƒ ƒ ƒ ƒ

4 7 10 7 4

-π/2 +π/3 0 -π/3 +π/2

Note the conjugate phase

f (in Hz)

DC is another name for zero-freq component DC component always has φ=0 or π (for real x(t) )

What is the formula for the signal x(t)? 8/31/2003

ω

AMPLITUDE, PHASE & FREQUENCY are shown 14

© 2003, JH McClellan & RW Schafer

0

16

8/31/2003

© 2003, JH McClellan & RW Schafer

17

Add Spectrum Components-1 ƒ Frequencies: ƒ ƒ ƒ ƒ ƒ

ƒ Amplitude & Phase ƒ ƒ ƒ ƒ ƒ

-250 Hz -100 Hz 0 Hz 100 Hz 250 Hz

-π π/2 +π π/3 0 -π π/3 +π π/2

4 7 10 7 4

4e − jπ / 2

7e − jπ / 3e j 2π (100)t + 7e jπ / 3e − j 2π (100)t 4e jπ / 2e j 2π ( 250)t + 4e − jπ / 2e − j 2π ( 250)t 18

© 2003, JH McClellan & RW Schafer

Simplify Components

7e

e

+ 7e

jπ / 3 − j 2π (100) t

e

4e jπ / 2e j 2π ( 250)t + 4e − jπ / 2e − j 2π ( 250)t A cos(ω t + ϕ ) = 12 Ae jϕ e jω t + 12 Ae − jϕ e − jω t © 2003, JH McClellan & RW Schafer

10

–100

7e − jπ / 3

0

100

4e jπ / 2 250

f (in Hz)

x (t ) = 10 + 7e − jπ / 3e j 2π (100)t + 7e jπ / 3e − j 2π (100)t 8/31/2003

4e jπ / 2e j 2π ( 250)t + 4e − jπ / 2e − j 2π ( 250)t © 2003, JH McClellan & RW Schafer

19

x (t ) = 10 + 14 cos(2π (100)t − π / 3) + 8 cos(2π ( 250)t + π / 2) So, we get the general form:

N

Use Euler’s Formula to get REAL sinusoids:

8/31/2003

jπ / 3

FINAL ANSWER

x (t ) = 10 + − jπ / 3 j 2π (100) t

7e

–250

x (t ) = 10 +

8/31/2003

Add Spectrum Components-2

20

x (t ) = A0 + ∑ Ak cos(2π f k t + ϕ k ) k =1

8/31/2003

© 2003, JH McClellan & RW Schafer

21

Summary: GENERAL FORM

Example: Synthetic Vowel

N

x (t ) = A0 + ∑ Ak cos(2π f k t + ϕ k ) k =1 N

{

x (t ) = X 0 + ∑ ℜe X k e j 2π f k t

ℜe{z} = 12 z +

k =1 1 z∗ 2 N

x (t ) = X 0 + ∑

{

k =1

8/31/2003

1 2

}

ƒ Sum of 5 Frequency Components

X k = Ak e jϕ k Frequency = f k

X k e j 2π f k t + 12 X k∗e − j 2π f k t

© 2003, JH McClellan & RW Schafer

} 22

8/31/2003

23

© 2003, JH McClellan & RW Schafer

SPECTRUM of VOWEL (Polar Format)

SPECTRUM of VOWEL ƒ Note: Spectrum has 0.5Xk (except XDC) ƒ Conjugates in negative frequency

0.5Ak

φk 8/31/2003

© 2003, JH McClellan & RW Schafer

24

8/31/2003

© 2003, JH McClellan & RW Schafer

25

Vowel Waveform (sum of all 5 components)

8/31/2003

© 2003, JH McClellan & RW Schafer

26

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Chapter 3, Sections 3-2 and 3-3 ƒ Chapter 3, Sections 3-7 and 3-8

Lecture 5 Periodic Signals, Harmonics & Time-Varying Sinusoids

ƒ Next Lecture:

ƒ Fourier Series ANALYSIS ƒ Sections 3-4, 3-5 and 3-6

1/28/2005

© 2003, JH McClellan & RW Schafer

1/28/2005

1

Problem Solving Skills ƒ Math Formula

ƒ Recorded Signals

1/28/2005

ƒ Signals with HARMONIC Frequencies ƒ Add Sinusoids with fk = kf0 N

ƒ S(t) versus t ƒ Spectrum

x (t ) = A0 + ∑ Ak cos(2π kf 0t + ϕ k ) k =1

ƒ MATLAB

ƒ Speech ƒ Music ƒ No simple formula

© 2003, JH McClellan & RW Schafer

3

LECTURE OBJECTIVES

ƒ Plot & Sketches

ƒ Sum of Cosines ƒ Amp, Freq, Phase

© 2003, JH McClellan & RW Schafer

ƒ Numerical ƒ Computation ƒ Plotting list of numbers

FREQUENCY can change vs. TIME Chirps: 2

x(t) = cos(α t )

Introduce Spectrogram Visualization (specgram.m) (plotspec.m) 4

1/28/2005

© 2003, JH McClellan & RW Schafer

5

SPECTRUM DIAGRAM

SPECTRUM for PERIODIC ?

ƒ Recall Complex Amplitude vs. Freq

ƒ Nearly Periodic in the Vowel Region

1 2

X k∗

4e

− jπ / 2

7e

jπ / 3

10 7e

X k = Ak e

–250

–100

1 2

− jπ / 3

4e jπ / 2

jϕ k

0

100

250

x (t ) = 10 + 14 cos(2π (100)t − π / 3) + 8 cos(2π ( 250)t + π / 2) 1/28/2005

ƒ Period is (Approximately) T = 0.0065 sec

X k = ak

f (in Hz)

© 2003, JH McClellan & RW Schafer

6

PERIODIC SIGNALS

x (t ) = e jω t x (t + T ) = x (t ) ?

x (t ) = x (t + T )

ƒ Example:

x (t ) = cos2 (3t )

T =? T=

2π 3

T = π3

ƒ Speech can be “quasi-periodic”

1/28/2005

© 2003, JH McClellan & RW Schafer

© 2003, JH McClellan & RW Schafer

7

Period of Complex Exponential

ƒ Repeat every T secs ƒ Definition

1/28/2005

8

Definition: Period is T

e jω ( t +T ) = e jω t e j 2π k = 1 ⇒ e jωT = 1 ⇒ ωT = 2π k 2π k ⎛ 2π ⎞ k = integer ω= =⎜ ⎟k = ω 0k 1/28/2005

T

⎝ T ⎠

© 2003, JH McClellan & RW Schafer

9

Harmonic Signal Spectrum

Define FUNDAMENTAL FREQ

Periodic signal can only have : f k = k f 0

N

x (t ) = A0 + ∑ Ak cos(2π kf 0t + ϕ k ) k =1

N

x (t ) = A0 + ∑ Ak cos(2π kf 0t + ϕ k ) k =1

X k = Ak e jϕ k N

x (t ) = X 0 + ∑ k =1

1/28/2005

{

1 2

f0 =

1 T

X k e j 2π kf 0t + 12 X k∗e − j 2π kf 0t

© 2003, JH McClellan & RW Schafer

}

10

Harmonic Signal (3 Freqs)

(ω0 = 2π f 0 )

fk = k f0

f0 =

1 T0

f 0 = fundamental Frequency (largest) T0 = fundamental Period (shortest) 1/28/2005

© 2003, JH McClellan & RW Schafer

11

POP QUIZ: FUNDAMENTAL ƒ Here’s another spectrum:

3rd

4e − jπ / 2

5th

–250

What is the fundamental frequency?

7e

jπ / 3

–100

10

7e − jπ / 3

0

100

10 Hz

4e jπ / 2 250

f (in Hz)

What is the fundamental frequency?

100 Hz ? 1/28/2005

© 2003, JH McClellan & RW Schafer

12

1/28/2005

50 Hz ? © 2003, JH McClellan & RW Schafer

13

IRRATIONAL SPECTRUM

Harmonic Signal (3 Freqs) T=0.1

SPECIAL RELATIONSHIP to get a PERIODIC SIGNAL

1/28/2005

© 2003, JH McClellan & RW Schafer

14

NON-Harmonic Signal

1/28/2005

© 2003, JH McClellan & RW Schafer

15

FREQUENCY ANALYSIS ƒ Now, a much HARDER problem ƒ Given a recording of a song, have the computer write the music

ƒ Can a machine extract frequencies? ƒ Yes, if we COMPUTE the spectrum for x(t) ƒ During short intervals 1/28/2005

© 2003, JH McClellan & RW Schafer

NOT PERIODIC 16

1/28/2005

© 2003, JH McClellan & RW Schafer

17

Frequency is the vertical axis

Time-Varying FREQUENCIES Diagram

1/28/2005

SIMPLE TEST SIGNAL ƒ C-major SCALE: stepped frequencies

A-440

ƒ Frequency is constant for each note

IDEAL

Time is the horizontal axis © 2003, JH McClellan & RW Schafer

18

1/28/2005

© 2003, JH McClellan & RW Schafer

R-rated: ADULTS ONLY

SPECTROGRAM EXAMPLE

ƒ SPECTROGRAM Tool

ƒ Two Constant Frequencies: Beats

19

ƒ MATLAB function is specgram.m ƒ SP-First has plotspec.m & spectgr.m

ƒ ANALYSIS program ƒ Takes x(t) as input & ƒ Produces spectrum values Xk ƒ Breaks x(t) into SHORT TIME SEGMENTS

cos(2π (660)t ) sin(2π (12)t )

ƒ Then uses the FFT (Fast Fourier Transform) 1/28/2005

© 2003, JH McClellan & RW Schafer

20

1/28/2005

© 2003, JH McClellan & RW Schafer

21

AM Radio Signal

SPECTRUM of AM (Beat)

ƒ Same as BEAT Notes

ƒ 4 complex exponentials in AM:

1 2

(e

1 4j

cos(2π (660)t ) sin(2π (12)t )

j 2π ( 660 ) t

(e 1 2

− e − j 2π (12 ) t

)

− e − j 2π ( 672 ) t − e j 2π ( 648) t + e − j 2π ( 648) t

)

+ e − j 2π ( 660) t

j 2π ( 672 ) t

cos(2π (672)t −

1/28/2005

) (e 1 2j

j 2π (12 ) t

π ) + 1 cos( 2π (648)t 2

2

+

1 4

e jπ / 2

–672

e − jπ / 2

1 4

0

–648

e jπ / 2

648

1 4

e − jπ / 2

672

f (in Hz)

What is the fundamental frequency?

π) 2

© 2003, JH McClellan & RW Schafer

1 4

648 Hz ? 22

STEPPED FREQUENCIES

1/28/2005

24 Hz ? © 2003, JH McClellan & RW Schafer

23

SPECTROGRAM of C-Scale

ƒ C-major SCALE: successive sinusoids

Sinusoids ONLY

ƒ Frequency is constant for each note

From SPECGRAM ANALYSIS PROGRAM

IDEAL

ARTIFACTS at Transitions 1/28/2005

© 2003, JH McClellan & RW Schafer

24

1/28/2005

© 2003, JH McClellan & RW Schafer

25

Spectrogram of LAB SONG

Time-Varying Frequency ƒ Frequency can change vs. time

Sinusoids ONLY Analysis Frame = 40ms

ƒ Continuously, not stepped

ƒ FREQUENCY MODULATION (FM)

ARTIFACTS at Transitions

x (t ) = cos(2π f c t + v (t )) VOICE

ƒ CHIRP SIGNALS ƒ Linear Frequency Modulation (LFM) 1/28/2005

© 2003, JH McClellan & RW Schafer

26

New Signal: Linear FM ƒ Called Chirp Signals (LFM) ƒ Quadratic phase

1/28/2005

ƒ Definition

x (t ) = A cos(ψ (t )) d ψ (t ) ⇒ ωi (t ) = dt

QUADRATIC

Derivative of the “Angle”

ƒ For Sinusoid:

x (t ) = A cos(2π f 0t + ϕ ) ψ (t ) = 2π f 0t + ϕ

ƒ Freq will change LINEARLY vs. time ƒ Example of Frequency Modulation (FM) ƒ Define “instantaneous frequency” © 2003, JH McClellan & RW Schafer

27

INSTANTANEOUS FREQ

x (t ) = A cos(α t 2 + 2π f 0 t + ϕ )

1/28/2005

© 2003, JH McClellan & RW Schafer

⇒ ωi ( t ) = 28

1/28/2005

d ψ (t ) dt

Makes sense

= 2π f 0

© 2003, JH McClellan & RW Schafer

29

INSTANTANEOUS FREQ of the Chirp

CHIRP SPECTROGRAM

ƒ Chirp Signals have Quadratic phase ƒ Freq will change LINEARLY vs. time

x (t ) = A cos(α t 2 + β t + ϕ ) ⇒ ψ (t ) = α t 2 + β t + ϕ ⇒ ωi ( t ) = 1/28/2005

d ψ (t ) dt

= 2α t + β

© 2003, JH McClellan & RW Schafer

30

CHIRP WAVEFORM

1/28/2005

© 2003, JH McClellan & RW Schafer

31

OTHER CHIRPS ƒ ψ(t) can be anything:

x (t ) = A cos(α cos( β t ) + ϕ ) ⇒ ωi (t ) = dtd ψ (t ) = −αβ sin( β t ) ƒ ψ(t) could be speech or music: ƒ FM radio broadcast 1/28/2005

© 2003, JH McClellan & RW Schafer

32

1/28/2005

© 2003, JH McClellan & RW Schafer

33

SINE-WAVE FREQUENCY MODULATION (FM)

Look at CD-ROM Demos in Ch 3 1/28/2005

© 2003, JH McClellan & RW Schafer

34

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Fourier Series in Ch 3, Sects 3-4, 3-5 & 3-6 ƒ Replaces pp. 62-66 in Ch 3 in DSP First ƒ Notation: ak for Fourier Series

Lecture 6 Fourier Series Coefficients

ƒ Other Reading: ƒ Next Lecture: More Fourier Series

9/8/2003

9/8/2003

1

© 2003, JH McClellan & RW Schafer

© 2003, JH McClellan & RW Schafer

LECTURE OBJECTIVES

HISTORY

ƒ Work with the Fourier Series Integral

ƒ Jean Baptiste Joseph Fourier

ak =

1 T0



T0

x (t )e

− j ( 2π k / T0 ) t

ƒ 1807 thesis (memoir)

dt

ƒ On the Propagation of Heat in Solid Bodies

ƒ Heat ! ƒ Napoleonic era

0

ƒ ANALYSIS via Fourier Series ƒ For PERIODIC signals:

3

x(t+T0) = x(t)

ƒ

http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Fourier.html

ƒ Later: spectrum from the Fourier Series 9/8/2003

© 2003, JH McClellan & RW Schafer

4

9/8/2003

© 2003, JH McClellan & RW Schafer

5

SPECTRUM DIAGRAM ƒ Recall Complex Amplitude vs. Freq 1 2

X k*

4e − jπ / 2 –250

7e

10

jπ / 3

7e

X k = Ake –100

N

jϕ k

0

{

− jπ / 3

1 2

X k = ak

4e jπ / 2

100

250

* x (t ) = Xa0 + ∑ {12 aXkk e j 2π f t + 12 aXkk∗ e − j 2π f t k =1

9/8/2003

© 2003, JH McClellan & RW Schafer

6

x (t ) =

∑ ak e

j 2π k f 0 t

7



j 2π k f 0 t a e ∑ k

k = −∞

ak = 12 X k = 12 Ak e jϕ k

PERIOD/FREQUENCY of COMPLEX EXPONENTIAL:

9/8/2003

}

© 2003, JH McClellan & RW Schafer

x (t ) =

k = −∞

2π 2π ( f 0 ) = ω0 = T0

k

Fourier Series Synthesis

Harmonic Signal ∞

9/8/2003

k

f (in Hz)

N

1 or T0 = f0

© 2003, JH McClellan & RW Schafer

x (t ) = A0 + ∑ Ak cos(2π kf 0t + ϕ k ) k =1

X k = Ak e 8

9/8/2003

jϕ k

© 2003, JH McClellan & RW Schafer

COMPLEX AMPLITUDE 9

Harmonic Signal (3 Freqs)

SYNTHESIS vs. ANALYSIS

a1 a3

ƒ SYNTHESIS

a5

ƒ ANALYSIS

ƒ Easy ƒ Given (ωk,Ak,φk) create x(t)

T = 0.1

ƒ Synthesis can be HARD

ƒ Hard ƒ Given x(t), extract (ω ωk,Ak,φk) ƒ How many? ƒ Need algorithm for computer

ƒ Synthesize Speech so that it sounds good

9/8/2003

10

© 2003, JH McClellan & RW Schafer

9/8/2003

11

© 2003, JH McClellan & RW Schafer

STRATEGY: x(t) Æ ak

INTEGRAL Property of exp(j)

ƒ ANALYSIS

ƒ INTEGRATE over ONE PERIOD

ƒ Get representation from the signal ƒ Works for PERIODIC Signals

T0 − j ( 2π / T0 ) mt = e − j ( 2π / T0 ) mt e dt ∫ − j 2π m 0 0 T0 = (e − j 2π m − 1) − j 2π m

ƒ Fourier Series ƒ Answer is: an INTEGRAL over one period

ak = 9/8/2003

1 T0



T0

x (t )e

− jω 0k t

T0

dt

− j ( 2π / T0 ) mt dt = 0 ∫e 0

0

© 2003, JH McClellan & RW Schafer

T0

T0

12

9/8/2003

m≠0

© 2003, JH McClellan & RW Schafer

ω0 =

2π T0 13

ORTHOGONALITY of exp(j)

Isolate One FS Coefficient

ƒ PRODUCT of exp(+j ) and exp(-j )

x (t ) =

T 0 k ≠ 1 0 j ( 2π / T0 ) t − j ( 2π / T0 ) kt e e dt =  ∫ T0 0 1 k = T

1 0 j ( 2π / T0 )( e ∫ T0 0 9/8/2003

−k ) t

1 T0

dt 14

∫ x (t )e

© 2003, JH McClellan & RW Schafer

− j ( 2π / T0 ) t

0

T0 1 T0

∫ x (t )e

T0

dt =

1 T0

 ∞  ak e j ( 2π / T0 ) k t e − j ( 2π / T0 ) t dt ∫  k∑ = −∞  0

 T0 j ( 2π / T ) k t − j ( 2π / T ) t  0 0 dt = ∑ ak  T1 ∫ e e dt  = a 0   k = −∞  0 Integral is zero  ∞

− j ( 2π / T0 ) k t

dt

except for k =

0

9/8/2003

15

© 2003, JH McClellan & RW Schafer

FS for a SQUARE WAVE

{ak}

T

1 0 ak = ∫ x (t )e − j ( 2π / T0 ) kt dt T0 0

(k ≠ 0)

.02

.02 1 − j ( 2π / .04 ) kt − j ( 2π / .04 ) kt 1 ak = 1e dt = .04( − j 2π k / .04 ) e 0 .04 ∫0

1

.02

− j ( 2π / T0 ) t

0

⇒ ak =

x(t)

9/8/2003

∫ x (t )e

T0 1 T0

1 0 ≤ t < 12 T0 x (t ) =  0 12 T0 ≤ t < T0 for T0 = 0.04 sec.

.01

0

k = −∞

SQUARE WAVE EXAMPLE

0

∑ ak e j ( 2π / T )k t

T0

© 2003, JH McClellan & RW Schafer

–.02



0.04

1 1 − ( −1)k − j (π ) k (e = − 1) = ( − j 2π k ) j 2π k

t 16

9/8/2003

© 2003, JH McClellan & RW Schafer

17

DC Coefficient: a0

Fourier Coefficients ak

T

1 0 ak = ∫ x (t )e − j ( 2π / T0 ) kt dt T0 0

ƒ ak is a function of k

(k = 0)

ƒ Complex Amplitude for k-th Harmonic ƒ This one doesn’t depend on the period, T0

T

1 0 1 a0 = ∫ x (t )dt = ( Area ) T0 0 T0

 1  jπ k k 1 − ( −1)  ak = = 0 j 2π k   12 

.02

a0 = 9/8/2003

1 1 1 dt = (.02 − 0) = .04 ∫0 .04

1 2

© 2003, JH McClellan & RW Schafer

18

Spectrum from Fourier Series ω0 = 2π /(0.04) = 2π (25)

− j  πk  ak =  0   12 

k = ±1,±3,… k = ±2,±4,… k =0

9/8/2003

20

k =0 19

Fourier Series Integral ƒ HOW do you determine ak from x(t) ? T0

ak =

a0 = © 2003, JH McClellan & RW Schafer

k = ±2,±4,…

© 2003, JH McClellan & RW Schafer

1 T0

− j ( 2π / T0 ) k t x ( t ) e dt ∫ 0

T0

9/8/2003

k = ±1,±3,…

9/8/2003

1 T0

Fundamental Frequency f 0 = 1 / T0

∫ x(t )dt

a−k = ak*

when x (t ) is real

(DC component)

0

© 2003, JH McClellan & RW Schafer

21

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Fourier Series in Ch 3, Sects 3-4, 3-5 & 3-6 ƒ Replaces pp. 62-66 in Ch 3 in DSP First ƒ Notation: ak for Fourier Series

Lecture 7 Fourier Series & Spectrum

ƒ Other Reading: ƒ Next Lecture: Sampling

9/13/2006

EE-2025

Spring-2005

3

jMc

LECTURE OBJECTIVES

SPECTRUM DIAGRAM

ƒ ANALYSIS via Fourier Series

ƒ Recall Complex Amplitude vs. Freq

ƒ For PERIODIC signals:

ak =

1 T0



ak∗

x(t+T0) = x(t)

T0

x (t )e

− j ( 2π k / T0 ) t

4e − jπ / 2

dt

7e jπ / 3

10

7e − jπ / 3

a0

ak = 12 Ak e jϕ k

4e jπ / 2

0

–250

ƒ SPECTRUM from Fourier Series

–100

N

0

100

{

250

x (t ) = a0 + ∑ ak e j 2π f k t + ak∗ e − j 2π f k t

ƒ ak is Complex Amplitude for k-th Harmonic

f (in Hz)

}

k =1

9/13/2006

EE-2025

Spring-2005

jMc

4

9/13/2006

EE-2025

Spring-2005

jMc

5

Harmonic Signal

Example

x (t ) = sin 3 (3π t )



x (t ) =

∑ ak e j 2π k f t 0

k = −∞

PERIOD/FREQUENCY of COMPLEX EXPONENTIAL:

2π ( ) 2π f 0 = ω0 = T0

9/13/2006

EE-2025

Example

Spring-2005

1 or T0 = f0

⎛ j⎞ ⎛ − 3 j ⎞ j 3π t ⎛ 3 j ⎞ − j 3π t ⎛ − j ⎞ − j 9π t x (t ) = ⎜ ⎟e j 9π t + ⎜ +⎜ + ⎜ ⎟e ⎟e ⎟e ⎝ 8 ⎠ ⎝ 8 ⎠ ⎝8⎠ ⎝ 8 ⎠ 6

jMc

x (t ) = sin 3 (3π t )

EE-2025

Spring-2005

jMc

7

STRATEGY: x(t) Æ ak

⎛ j⎞ ⎛ − 3 j ⎞ j 3π t ⎛ 3 j ⎞ − j 3π t ⎛ − j ⎞ − j 9π t x (t ) = ⎜ ⎟e j 9π t + ⎜ +⎜ + ⎜ ⎟e ⎟e ⎟e ⎝8⎠ ⎝ 8 ⎠ ⎝ 8 ⎠ ⎝ 8 ⎠ In this case, analysis just requires picking off the coefficients.

9/13/2006

ak

ƒ ANALYSIS ƒ Get representation from the signal ƒ Works for PERIODIC Signals

ƒ Fourier Series ƒ Answer is: an INTEGRAL over one period

k = −3 9/13/2006

k =1

k = −1

EE-2025

Spring-2005

jMc

ak =

k =3 8

9/13/2006

1 T0



T0

x (t )e − jω0k t dt

0

EE-2025

Spring-2005

jMc

9

FS: Rectified Sine Wave {ak} T0

1 ak = T0 ak =

∫ x (t )e

− j ( 2π / T0 ) kt

0

Half-Wave Rectified Sine

T0 / 2



1 T0

( k ≠ ±1)

dt

sin( 2Tπ 0

t) e

− j ( 2π / T0 ) kt

=



1 T0

j ( 2π / T0 ) t

e

0

=

T0 / 2 1 j 2T0



e

−e 2j

− j ( 2π / T0 ) t

− j ( 2π / T0 )( k −1) t

dt −

e − j ( 2π / T0 ) kt dt

=

e − j ( 2π / T0 )( k +1) t dt



T0 / 2



j 2T0 ( − j ( 2π / T0 )( k −1))

9/13/2006

e − j ( 2π / T0 )( k +1) t Spring-2005

jMc

10

0

SQUARE WAVE EXAMPLE

9/13/2006

EE-2025

.02

Spring-2005

jMc

k +1− ( k −1)

9/13/2006

4π ( k 2 −1)

− j ( 2π / T0 )( k −1)T0 / 2

)

)

(

)

− 1 − 4π (1k +1) e − j ( 2π / T0 )( k +1)T0 / 2 − 1

(

)

− 1 − 4π (1k +1) e − jπ ( k +1) − 1

⎧ 0 ⎪ 1 − (−1) k − 1 = ⎨ ±?j 4 ⎪ −1 ⎩ π ( k 2 −1)

)(

0

)

EE-2025

Spring-2005

k odd k = ±1 k even 11

jMc

ƒ Complex Amplitude for k-th Harmonic ƒ This one doesn’t depend on the period, T0

⎧ 1 ⎪ jπ k k 1 − ( −1) ⎪ ak = =⎨ 0 j 2π k ⎪ ⎪ 12 ⎩

1

.01

(

j 2T0 ( − j ( 2π / T0 )( k +1))

0

− jπ ( k −1)

T0 / 2

ƒ ak is a function of k

x(t)

0

1 4π ( k −1)

(e (e

e − j ( 2π / T0 )( k +1)t

Fourier Coefficients ak

⎧⎪1 0 ≤ t < 12 T0 x (t ) = ⎨ ⎪⎩0 12 T0 ≤ t < T0 for T0 = 0.04 sec.

–.02

=

T0 / 2

j 2T0 ( − j ( 2π / T0 )( k +1))

EE-2025

0



j 2T0 ( − j ( 2π / T0 )( k −1)) 1 4π ( k −1)

=

0

T0 / 2

e − j ( 2π / T0 )( k −1)t

=

T0 / 2 1 j 2T0

0

e − j ( 2π / T0 )( k −1) t

ak =

dt

0 T0 / 2

FS: Rectified Sine Wave {ak}

0.04

t 12

9/13/2006

EE-2025

Spring-2005

k = ±1,±3,K k = ±2,±4,K k =0 jMc

15

Spectrum from Fourier Series ⎧− j ⎪πk ⎪ ak = ⎨ 0 ⎪ ⎪ 12 ⎩

ω0 = 2π /(0.04) = 2π (25)

k = ±1,±3,K k = ±2,±4,K k =0

Fourier Series Synthesis ƒ HOW do you APPROXIMATE x(t) ?

ak =

T0 1 T0

− j ( 2π / T0 ) k t x ( t ) e dt ∫ 0

ƒ Use FINITE number of coefficients

x (t ) =

N

j 2π k f 0 t a e ∑ k

a−k = ak*

when x (t ) is real

k =− N 9/13/2006

EE-2025

Spring-2005

jMc

16

EE-2025

Spring-2005

jMc

EE-2025

Spring-2005

jMc

17

Synthesis: 1st & 3rd Harmonics

Fourier Series Synthesis

9/13/2006

9/13/2006

y (t ) =

18

9/13/2006

1 2 2 + cos(2π ( 25)t − π2 ) + cos(2π (75)t − π2 ) 2 π 3π

EE-2025

Spring-2005

jMc

19

Synthesis: up to 7th Harmonic 2 2 1 2 2 y (t ) = + cos(50π t − π2 ) + sin(150π t ) + sin( 250π t ) + sin(350π t ) 5π 7π 2 π 3π

9/13/2006

EE-2025

Spring-2005

jMc

20

Gibbs’ Phenomenon

Fourier Synthesis x N (t ) =

1 2 2 + sin(ω0t ) + sin(3ω0t ) + K 2 π 3π

9/13/2006

EE-2025

Spring-2005

jMc

21

Fourier Series Demos

ƒ Convergence at DISCONTINUITY of x(t)

ƒ Fourier Series Java Applet

ƒ There is always an overshoot ƒ 9% for the Square Wave case

ƒ Greg Slabaugh ƒ Interactive ƒ http://users.ece.gatech.edu/mcclella/2025/Fsdemo_Slabaugh/fourier.html

ƒ MATLAB GUI: fseriesdemo ƒ http://users.ece.gatech.edu/mcclella/matlabGUIs/index.html 9/13/2006

EE-2025

Spring-2005

jMc

22

9/13/2006

EE-2025

Spring-2005

jMc

23

fseriesdemo GUI

9/13/2006

EE-2025

Spring-2005

jMc

24

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Chap 4, Sections 4-1 and 4-2 ƒ Replaces Ch 4 in DSP First, pp. 83-94

Lecture 8 Sampling & Aliasing

9/14/2003

ƒ Other Reading: ƒ Recitation: Strobe Demo (Sect 4-3) ƒ Next Lecture: Chap. 4 Sects. 4-4 and 4-5

9/14/2003

1

© 2003, JH McClellan & RW Schafer

LECTURE OBJECTIVES

3

© 2003, JH McClellan & RW Schafer

SYSTEMS Process Signals

ƒ SAMPLING can cause ALIASING

x(t)

ƒ Sampling Theorem ƒ Sampling Rate > 2(Highest Frequency)

SYSTEM

y(t)

ƒ PROCESSING GOALS:

ƒ Spectrum for digital signals, x[n]

ƒ Change x(t) into y(t)

ƒ Normalized Frequency

ƒ For example, more BASS

2πf + 2π ωˆ = ωTs = fs

ƒ Improve x(t), e.g., image deblurring ƒ Extract Information from x(t)

ALIASING

9/14/2003

© 2003, JH McClellan & RW Schafer

4

9/14/2003

© 2003, JH McClellan & RW Schafer

5

System IMPLEMENTATION

SAMPLING x(t)

ƒ ANALOG/ELECTRONIC:

ƒ SAMPLING PROCESS

ƒ Circuits: resistors, capacitors, op-amps x(t)

ƒ Convert x(t) to numbers x[n] ƒ “n” is an integer; x[n] is a sequence of values ƒ Think of “n” as the storage address in memory

y(t)

ELECTRONICS

ƒ UNIFORM SAMPLING at t = nTs

ƒ DIGITAL/MICROPROCESSOR

ƒ IDEAL: x[n] = x(nTs)

ƒ Convert x(t) to numbers stored in memory x(t)

A-to-D

x[n]

9/14/2003

COMPUTER

y[n]

D-to-A

x(t)

y(t)

© 2003, JH McClellan & RW Schafer

6

9/14/2003

C-to-D

x[n]

© 2003, JH McClellan & RW Schafer

7

© 2003, JH McClellan & RW Schafer

9

f = 100Hz

SAMPLING RATE, fs ƒ SAMPLING RATE (fs) ƒ fs =1/Ts

f s = 2 kHz

ƒ NUMBER of SAMPLES PER SECOND

ƒ Ts = 125 microsec Æ fs = 8000 samples/sec • UNITS ARE HERTZ: 8000 Hz

ƒ UNIFORM SAMPLING at t = nTs = n/fs ƒ IDEAL: x[n] = x(nTs)=x(n/fs) x(t) 9/14/2003

C-to-D

f s = 500Hz

x[n]=x(nTs)

© 2003, JH McClellan & RW Schafer

8

9/14/2003

SAMPLING THEOREM

Reconstruction? Which One? Given the samples, draw a sinusoid through the values

ƒ HOW OFTEN ? ƒ DEPENDS on FREQUENCY of SINUSOID ƒ ANSWERED by SHANNON/NYQUIST Theorem ƒ ALSO DEPENDS on “RECONSTRUCTION”

x[n ] = cos(0.4π n ) 9/14/2003

© 2003, JH McClellan & RW Schafer

10

9/14/2003

When n is an integer cos(0.4π n ) = cos(2.4π n )

© 2003, JH McClellan & RW Schafer

STORING DIGITAL SOUND

DISCRETE-TIME SINUSOID

ƒ x[n] is a SAMPLED SINUSOID

ƒ Change x(t) into x[n]

11

DERIVATION

x (t ) = A cos(ω t + ϕ ) x[n ] = x ( nTs ) = A cos(ω nTs + ϕ )

ƒ A list of numbers stored in memory

ƒ EXAMPLE: audio CD ƒ CD rate is 44,100 samples per second

x[n ] = A cos((ωTs )n + ϕ )

ƒ 16-bit samples ƒ Stereo uses 2 channels

x[n ] = A cos(ωˆ n + ϕ ) ωˆ = ω Ts = ωf DEFINE DIGITAL FREQUENCY

ƒ Number of bytes for 1 minute is ƒ 2 X (16/8) X 60 X 44100 = 10.584 Mbytes

s

9/14/2003

© 2003, JH McClellan & RW Schafer

12

9/14/2003

© 2003, JH McClellan & RW Schafer

13

ωˆ

DIGITAL FREQUENCY

SPECTRUM (DIGITAL)

ωˆ

f ωˆ = 2π fs

VARIES from 0 to 2π π, as f varies from 0 to the sampling frequency ƒ UNITS are radians, not rad/sec

ƒ

9/14/2003

f s = 100 Hz

1 2

X*

X

2π(0.1) π(0.1)

ωˆ

2πf fs 14

© 2003, JH McClellan & RW Schafer

f fs

1 2

x[n ] = A cos(2π (100)( n / 1000) + ϕ )

SPECTRUM (DIGITAL) ??? ωˆ = 2π

X*

–0.2π π

f s = 1 kHz

ƒ DIGITAL FREQUENCY is NORMALIZED

ωˆ = ωTs =

1 2

?

–2π π

1 2

x[n ] = A cos(2π (100)( n / 100) + ϕ )

© 2003, JH McClellan & RW Schafer

15

The REST of the STORY

X

2π(1) π(1)

9/14/2003

ƒ Spectrum of x[n] has more than one line for each complex exponential

ωˆ

ƒ Called ALIASING ƒ MANY SPECTRAL LINES

ƒ SPECTRUM is PERIODIC with period = 2π π ƒ Because

A cos(ωˆ n + ϕ ) = A cos((ωˆ + 2π )n + ϕ )

x[n] is zero frequency??? 9/14/2003

© 2003, JH McClellan & RW Schafer

16

9/14/2003

© 2003, JH McClellan & RW Schafer

17

ALIASING DERIVATION ƒ Other Frequencies give the same

ALIASING DERIVATION–2

ωˆ

ƒ Other Frequencies give the same

x1 (t ) = cos(400π t ) sampled at f s = 1000 Hz

If x (t) = A cos( 2 π ( f + f s )t + ϕ )

n x1[n ] = cos(400π 1000 ) = cos(0.4π n )

n x2 [n ] = cos(2400π 1000 ) = cos(2.4π n )

x2 [n ] = cos(2.4π n ) = cos(0.4π n + 2π n ) = cos(0.4π n )

9/14/2003

then : ωˆ =

2π ( f + f s ) 2π f 2π f s = + fs fs fs

ωˆ = ωTs =

2400π − 400π = 2π (1000) © 2003, JH McClellan & RW Schafer

18

9/14/2003

2π f + 2π fs

© 2003, JH McClellan & RW Schafer

ALIASING CONCLUSIONS

NORMALIZED FREQUENCY

ƒ ADDING fs or 2fs or –fs to the FREQ of x(t) gives exactly the same x[n]

ƒ DIGITAL FREQUENCY

ƒ The samples, x[n] = x(n/ fs ) are EXACTLY THE SAME VALUES

ωˆ = ωTs =

ƒ GIVEN x[n], WE CAN’T DISTINGUISH fo FROM (fo + fs ) or (fo + 2fs ) 9/14/2003

© 2003, JH McClellan & RW Schafer

t←

and we want : x[n] = Acos(ωˆ n + ϕ )

x2 (t ) = cos(2400π t ) sampled at f s = 1000 Hz

⇒ x2 [n ] = x1[n ]

ωˆ

20

9/14/2003

19

2πf + 2π fs

© 2003, JH McClellan & RW Schafer

21

n fs

SPECTRUM for x[n]

SPECTRUM (MORE LINES)

ƒ PLOT versus NORMALIZED FREQUENCY ƒ INCLUDE ALL SPECTRUM LINES ƒ ALIASES

f ωˆ = 2π fs f s = 1 kHz

ƒ ADD MULTIPLES of 2π π ƒ SUBTRACT MULTIPLES of 2π π

1 2

X

–1.8π π

1 2

X*

–0.2π π

1 2

X

2π(0.1) π(0.1)

1 2

X*

1.8π π

ωˆ

x[n ] = A cos(2π (100)( n / 1000) + ϕ )

ƒ FOLDED ALIASES ƒ (to be discussed later) ƒ ALIASES of NEGATIVE FREQS 9/14/2003

22

© 2003, JH McClellan & RW Schafer

SPECTRUM (ALIASING CASE) ωˆ = 2π

f fs

f s = 80 kHz

9/14/2003

1 2

X*

–2.5π π

1 2

X

–1.5π π

1 2

X*

–0.5π π

1 2

X

0.5π π

1 2

X*

1.5π π

1 2

9/14/2003

© 2003, JH McClellan & RW Schafer

23

SAMPLING GUI (con2dis)

X

2.5π π

ωˆ

x[n ] = A cos(2π (100)( n / 80) + ϕ )

© 2003, JH McClellan & RW Schafer

24

9/14/2003

© 2003, JH McClellan & RW Schafer

25

SPECTRUM (FOLDING CASE) f ωˆ = 2π fs f s = 125Hz

1 2

X*

–1.6π π

1 2

X

–0.4π π

1 2

X*

0.4π π

1 2

X

1.6π π

ωˆ

x[n ] = A cos(2π (100)( n / 125) + ϕ )

9/14/2003

© 2003, JH McClellan & RW Schafer

26

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Chapter 4: Sections 4-4, 4-5

Lecture 9 D-to-A Conversion

8/22/2003

© 2003, JH McClellan & RW Schafer

ƒ Other Reading: ƒ Recitation: Section 4-3 (Strobe Demo) ƒ Next Lecture: Chapter 5 (beginning)

8/22/2003

1

LECTURE OBJECTIVES

SIGNAL TYPES

ƒ FOLDING: a type of ALIASING ƒ DIGITAL-to-ANALOG CONVERSION is

x(t)

ƒ Reconstruction from samples ƒ Smooth Interpolation

x[n]

COMPUTER

y[n]

D-to-A

y(t)

ƒ Convert x(t) to numbers stored in memory

ƒ Mathematical Model of D-to-A

ƒ D-to-A ƒ Convert y[n] back to a “continuous-time” signal, y(t)

ƒ SUM of SHIFTED PULSES ƒ Linear Interpolation example

© 2003, JH McClellan & RW Schafer

A-to-D

ƒ A-to-D

ƒ SAMPLING THEOREM applies

8/22/2003

3

© 2003, JH McClellan & RW Schafer

ƒ y[n] is called a “discrete-time” signal 4

8/22/2003

© 2003, JH McClellan & RW Schafer

5

SAMPLING x(t)

NYQUIST RATE

ƒ UNIFORM SAMPLING at t = nTs

ƒ “Nyquist Rate” Sampling

ƒ IDEAL: x[n] = x(nTs) x(t)

C-to-D

ƒ fs > TWICE the HIGHEST Frequency in x(t) ƒ “Sampling above the Nyquist rate”

x[n]

ƒ BANDLIMITED SIGNALS ƒ DEF: x(t) has a HIGHEST FREQUENCY COMPONENT in its SPECTRUM ƒ NON-BANDLIMITED EXAMPLE ƒ TRIANGLE WAVE is NOT BANDLIMITED

8/22/2003

6

© 2003, JH McClellan & RW Schafer

8/22/2003

© 2003, JH McClellan & RW Schafer

SPECTRUM for x[n]

EXAMPLE: SPECTRUM

ƒ INCLUDE ALL SPECTRUM LINES

ƒ x[n] = Acos(0.2πn+φ) ƒ FREQS @ 0.2π and -0.2π ƒ ALIASES:

ƒ ALIASES ƒ ADD INTEGER MULTIPLES of

2π π and -2π π

ƒ FOLDED ALIASES

ƒ {2.2π, 4.2π, 6.2π, …} & {-1.8π,-3.8π,…} ƒ EX: x[n] = Acos(4.2πn+φ)

ƒ ALIASES of NEGATIVE FREQS

ƒ PLOT versus NORMALIZED FREQUENCY ƒ i.e., DIVIDE fo by fs 8/22/2003

ωˆ = 2π

© 2003, JH McClellan & RW Schafer

7

ƒ ALIASES of NEGATIVE FREQ:

f + 2π fs

ƒ {1.8π,3.8π,5.8π,…} & {-2.2π, -4.2π …}

8

8/22/2003

© 2003, JH McClellan & RW Schafer

9

SPECTRUM (ALIASING CASE)

SPECTRUM (MORE LINES) f ωˆ = 2π fs f s = 1 kHz

1 2

X

–1.8π π

1 2

X*

–0.2π π

1 2

X

2π(0.1) π(0.1)

1 2

X*

1.8π π

ωˆ

f ωˆ = 2π fs f s = 80 kHz

x[n ] = A cos(2π (100)( n / 1000) + ϕ )

8/22/2003

© 2003, JH McClellan & RW Schafer

10

FOLDING (a type of ALIASING)

1 2

X*

–2.5π π

1 2

X

1 2

–1.5π π

X*

1 2

X

0.5π π

–0.5π π

1 2

X*

1 2

1.5π π

X

2.5π π

ωˆ

x[n ] = A cos(2π (100)( n / 80) + ϕ )

8/22/2003

11

© 2003, JH McClellan & RW Schafer

DIGITAL FREQ

ωˆ

AGAIN

ƒ EXAMPLE: 3 different x(t); same x[n] 100 ωˆ = 2π = 2π (0.1) f s = 1000 1000 cos(2π (100)t ) → cos[2π (0.1)n ] cos(2π (1100)t ) → cos[2π (1.1)n ] = cos[2π (0.1)n ] cos(2π (900)t ) → cos[2π (0.9)n ] = cos[2π (0.9)n − 2π n ] = cos[2π ( −0.1)n ] = cos[2π (0.1)n ]

ƒ 900 Hz “folds” to 100 Hz when fs=1kHz 8/22/2003

© 2003, JH McClellan & RW Schafer

12

ωˆ = ωTs =

2π f + 2π fs

ωˆ = ωTs = − 8/22/2003

2π f + 2π fs

© 2003, JH McClellan & RW Schafer

ALIASING

FOLDED ALIAS

13

SPECTRUM (FOLDING CASE) f ωˆ = 2π fs f s = 125Hz

1 2

X*

–1.6π π

1 2

X

–0.4π π

1 2

X*

0.4π π

1 2

FREQUENCY DOMAINS

X

1.6π π

x(t)

A-to-D

x[n]

y[n]

f

ω



f ωˆ ωˆ = 2π fs

+ 2π © 2003, JH McClellan & RW Schafer

y(t)

ωˆ

x[n ] = A cos(2π (100)( n / 125) + ϕ )

8/22/2003

D-to-A

14

8/22/2003

f =

ωˆ fs 2π

© 2003, JH McClellan & RW Schafer

f

15

SAMPLING GUI (con2dis)

DEMOS from CHAPTER 4 ƒ CD-ROM DEMOS ƒ SAMPLING DEMO (con2dis GUI) ƒ Different Sampling Rates ƒ Aliasing of a Sinusoid

ƒ STROBE DEMO ƒ Synthetic vs. Real ƒ Television SAMPLES at 30 fps

ƒ Sampling & Reconstruction 8/22/2003

© 2003, JH McClellan & RW Schafer

16

8/22/2003

© 2003, JH McClellan & RW Schafer

17

D-to-A Reconstruction x(t)

A-to-D

x[n]

y[n]

COMPUTER

D-to-A is AMBIGUOUS !

D-to-A

y(t)

ƒ ALIASING ƒ Given y[n], which y(t) do we pick ? ? ? ƒ INFINITE NUMBER of y(t)

ƒ Create continuous y(t) from y[n]

ƒ PASSING THRU THE SAMPLES, y[n]

ƒ IDEAL

ƒ D-to-A RECONSTRUCTION MUST CHOOSE ONE OUTPUT

ƒ If you have formula for y[n]

ƒ Replace n in y[n] with fst ƒ y[n] = Acos(0.2πn+φ) with fs = 8000 Hz ƒ y(t) = Acos(2π(800)t+φ) 8/22/2003

ƒ RECONSTRUCT THE SMOOTHEST ONE ƒ THE LOWEST FREQ, if y[n] = sinusoid 19

© 2003, JH McClellan & RW Schafer

SPECTRUM (ALIASING CASE) ωˆ = 2π

f fs

1 2

X*

π f s = 80Hz –2.5π

1 2

X

–1.5π π

1 2

X*

–0.5π π

1 2

X

0.5π π

1 2

X*

1.5π π

1 2

X

2.5π π

ωˆ

x[n ] = A cos(2π (100)( n / 80) + ϕ )

8/22/2003

20

© 2003, JH McClellan & RW Schafer

Reconstruction (D-to-A) ƒ CONVERT STREAM of NUMBERS to x(t) ƒ “CONNECT THE DOTS” ƒ INTERPOLATION INTUITIVE, conveys the idea

y[k] y(t) kTs

8/22/2003

© 2003, JH McClellan & RW Schafer

21

8/22/2003

(k+1)Ts

© 2003, JH McClellan & RW Schafer

t 22

SQUARE PULSE CASE

SAMPLE & HOLD DEVICE ƒ CONVERT y[n] to y(t) ƒ y[k] should be the value of y(t) at t = kTs ƒ Make y(t) equal to y[k] for ƒ kTs -0.5Ts < t < kTs +0.5Ts y[k]

STAIR-STEP APPROXIMATION

y(t) kTs 8/22/2003

(k+1)Ts

t

© 2003, JH McClellan & RW Schafer

23

OVER-SAMPLING CASE

8/22/2003

© 2003, JH McClellan & RW Schafer

24

MATH MODEL for D-to-A

EASIER TO RECONSTRUCT SQUARE PULSE:

8/22/2003

© 2003, JH McClellan & RW Schafer

25

8/22/2003

© 2003, JH McClellan & RW Schafer

26

EXPAND the SUMMATION ∞

∑ y[n]p(t − nT ) = s

n= −∞

…+ y[0]p(t) + y[1]p(t − Ts ) + y[2]p(t − 2Ts ) + …

p(t)

ƒ SUM of SHIFTED PULSES p(t-nTs) ƒ “WEIGHTED” by y[n] ƒ CENTERED at t=nTs ƒ SPACED by Ts ƒ RESTORES “REAL TIME” 8/22/2003

© 2003, JH McClellan & RW Schafer

27

TRIANGULAR PULSE (2X)

8/22/2003

© 2003, JH McClellan & RW Schafer

28

OPTIMAL PULSE ? CALLED “BANDLIMITED INTERPOLATION”

p (t ) =

sin πTst πt

for − ∞ < t < ∞

Ts

p(t ) = 0 for t = ±Ts , ± 2Ts ,… 8/22/2003

© 2003, JH McClellan & RW Schafer

29

8/22/2003

© 2003, JH McClellan & RW Schafer

30

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Chapter 5, Sects. 5-1, 5-2 and 5-3 (partial)

Lecture 10 FIR Filtering Intro

ƒ Other Reading: ƒ Recitation: Ch. 5, Sects 5-4, 5-6, 5-7 and 5-8 ƒ CONVOLUTION

ƒ Next Lecture: Ch 5, Sects. 5-3, 5-5 and 5-6

2/18/2005

© 2003, JH McClellan & RW Schafer

2/18/2005

1

© 2003, JH McClellan & RW Schafer

3

LECTURE OBJECTIVES

DIGITAL FILTERING

ƒ INTRODUCE FILTERING IDEA

x(t)

ƒ Weighted Average ƒ Running Average

© 2003, JH McClellan & RW Schafer

COMPUTER

y[n]

D-to-A

y(t)

ƒ PROCESSING ALGORITHMS ƒ SOFTWARE (MATLAB) ƒ HARDWARE: DSP chips, VLSI

Filters

ƒ Show how to compute the output y[n] from the input signal, x[n]

2/18/2005

x[n]

ƒ CONCENTRATE on the COMPUTER

ƒ FINITE IMPULSE RESPONSE FILTERS

ƒ FIR

A-to-D

ƒ DSP: DIGITAL SIGNAL PROCESSING 4

2/18/2005

© 2003, JH McClellan & RW Schafer

5

The TMS32010, 1983

Rockland Digital Filter, 1971

First PC plug-in board from Atlanta Signal Processors Inc. For the price of a small house, you could have one of these. 2/18/2005

© 2003, JH McClellan & RW Schafer

6

Digital Cell Phone (ca. 2000)

2/18/2005

© 2003, JH McClellan & RW Schafer

7

DISCRETE-TIME SYSTEM x[n]

COMPUTER

y[n]

ƒ OPERATE on x[n] to get y[n] ƒ WANT a GENERAL CLASS of SYSTEMS ƒ ANALYZE the SYSTEM ƒ TOOLS: TIME-DOMAIN & FREQUENCYDOMAIN

ƒ SYNTHESIZE the SYSTEM 2/18/2005

Now it plays video © 2003, JH McClellan & RW Schafer

8

2/18/2005

© 2003, JH McClellan & RW Schafer

9

D-T SYSTEM EXAMPLES x[n]

SYSTEM

DISCRETE-TIME SIGNAL ƒ x[n] is a LIST of NUMBERS

y[n]

ƒ INDEXED by “n”

ƒ EXAMPLES: ƒ POINTWISE OPERATORS

STEM PLOT

ƒ SQUARING: y[n] = (x[n])2

ƒ RUNNING AVERAGE ƒ RULE: “the output at time n is the average of three consecutive input values” 2/18/2005

© 2003, JH McClellan & RW Schafer

10

3-PT AVERAGE SYSTEM

2/18/2005

© 2003, JH McClellan & RW Schafer

11

INPUT SIGNAL

ƒ ADD 3 CONSECUTIVE NUMBERS ƒ Do this for each “n” Make a TABLE

y[n ] = 13 ( x[n ] + x[n + 1] + x[n + 2])

y[n ] = 13 ( x[n ] + x[n + 1] + x[n + 2])

OUTPUT SIGNAL

n=0 2/18/2005

n=1

© 2003, JH McClellan & RW Schafer

12

2/18/2005

© 2003, JH McClellan & RW Schafer

13

PAST, PRESENT, FUTURE

ANOTHER 3-pt AVERAGER ƒ Uses “PAST” VALUES of x[n] ƒ IMPORTANT IF “n” represents REAL TIME ƒ WHEN x[n] & y[n] ARE STREAMS

y[n ] = 13 ( x[n ] + x[n − 1] + x[n − 2]) “n” is TIME

2/18/2005

© 2003, JH McClellan & RW Schafer

14

GENERAL CAUSAL FIR FILTER ƒ FILTER COEFFICIENTS {bk} ƒ DEFINE THE FILTER

2/18/2005

© 2003, JH McClellan & RW Schafer

15

GENERAL FIR FILTER ƒ FILTER COEFFICIENTS {bk}

M

M

y[n ] = ∑ bk x[n − k ]

y[n ] = ∑ bk x[n − k ]

k =0

k =0

ƒ For example, bk = {3, − 1, 2,1}

ƒ FILTER ORDER is M ƒ FILTER LENGTH is L = M+1

3

y[n ] = ∑ bk x[n − k ]

ƒ NUMBER of FILTER COEFFS is L

k =0

= 3x[n ] − x[n − 1] + 2 x[n − 2] + x[n − 3] 2/18/2005

© 2003, JH McClellan & RW Schafer

16

2/18/2005

© 2003, JH McClellan & RW Schafer

17

GENERAL CAUSAL FIR FILTER

FILTERED STOCK SIGNAL

ƒ SLIDE a WINDOW across x[n] M

y[n ] = ∑ bk x[n − k ]

INPUT

k =0

OUTPUT

x[n-M] 2/18/2005

x[n] © 2003, JH McClellan & RW Schafer

18

2/18/2005

50-pt Averager 19

© 2003, JH McClellan & RW Schafer

UNIT IMPULSE SIGNAL δ[n]

SPECIAL INPUT SIGNALS ƒ x[n] = SINUSOID FREQUENCY RESPONSE (LATER) ƒ x[n] has only one NON-ZERO VALUE

⎧⎪1 n = 0 δ [n ] = ⎨ ⎪⎩0 n ≠ 0

UNIT-IMPULSE

δ[n] is NON-ZERO When its argument is equal to ZERO

δ [n − 3]

n=3

1 n

2/18/2005

© 2003, JH McClellan & RW Schafer

20

2/18/2005

© 2003, JH McClellan & RW Schafer

21

SUM of SHIFTED IMPULSES

MATH FORMULA for x[n] ƒ Use SHIFTED IMPULSES to write x[n] x[n ] = 2δ [n ] + 4δ [n − 1] + 6δ [n − 2] + 4δ [n − 3] + 2δ [n − 4]

This formula ALWAYS works

2/18/2005

© 2003, JH McClellan & RW Schafer

22

4-pt AVERAGER

2/18/2005

y[n ] = 14 ( x[n ] + x[n − 1] + x[n − 2] + x[n − 3])

y[n ] = 14 ( x[n ] + x[n − 1] + x[n − 2] + x[n − 3])

δ[n] “READS OUT” the FILTER COEFFICIENTS

ƒ INPUT = UNIT IMPULSE SIGNAL = δ[n] x[n ] = δ [n ] y[n ] = 14 δ [n ] + 14 δ [n − 1] + 14 δ [n − 2] + 14 δ [n − 3]

h[n ] = {K , 0, 0, 14 , 14 , 14 , 14 , 0, 0, K} “h” in h[n] denotes Impulse Response

n=0 n=–1 n=0

ƒ OUTPUT is called “IMPULSE RESPONSE”

NON-ZERO When window overlaps δ[n]

1 n=1

h[n ] = {K , 0, 0, 14 , 14 , 14 , 14 , 0, 0, K} © 2003, JH McClellan & RW Schafer

23

4-pt Avg Impulse Response

ƒ CAUSAL SYSTEM: USE PAST VALUES

2/18/2005

© 2003, JH McClellan & RW Schafer

n n=4 n=5 24

2/18/2005

© 2003, JH McClellan & RW Schafer

25

FIR IMPULSE RESPONSE

FILTERING EXAMPLE

ƒ Convolution = Filter Definition ƒ Filter Coeffs = Impulse Response

ƒ 7-point AVERAGER ƒ Removes cosine

6

y7 [n ] = ∑ (17 )x[n − k ]

k =0 ƒ By making its amplitude (A) smaller

M

y[n ] = ∑ bk x[n − k ] k =0

2/18/2005

ƒ 3-point AVERAGER

M

y[n ] = ∑ h[k ] x[n − k ] k =0

ƒ Changes A slightly

y3[n ] = ∑ (13 )x[n − k ] k =0

CONVOLUTION

© 2003, JH McClellan & RW Schafer

26

Input : x[n ] = (1.02)n + cos(2π n / 8 + π / 4)

2/18/2005

© 2003, JH McClellan & RW Schafer

27

7-pt FIR EXAMPLE (AVG)

3-pt AVG EXAMPLE for 0 ≤ n ≤ 40

Input : x[n ] = (1.02)n + cos(2π n / 8 + π / 4)

for 0 ≤ n ≤ 40

CAUSAL: Use Previous

USE PAST VALUES

2/18/2005

2

© 2003, JH McClellan & RW Schafer

28

2/18/2005

© 2003, JH McClellan & RW Schafer

29

LONGER OUTPUT

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Chapter 5, Sections 5-5 and 5-6 ƒ Section 5-4 will be covered, but not “in depth”

Lecture 11 Linearity & Time-Invariance Convolution

ƒ Other Reading: ƒ Recitation: Ch. 5, Sects 5-6, 5-7 & 5-8 ƒ CONVOLUTION

ƒ Next Lecture: start Chapter 6 8/22/2003

© 2003, JH McClellan & RW Schafer

8/22/2003

1

LECTURE OBJECTIVES

ƒ IMPULSE RESPONSE, h[n ]

LINEARITY LTI SYSTEMS TIME-INVARIANCE ==> CONVOLUTION

ƒ FIR case: same as {bk }

ƒ CONVOLUTION ƒ GENERAL: y[n ] = h[n ] ∗ x[n ] ƒ GENERAL CLASS of SYSTEMS

ƒ BLOCK DIAGRAM REPRESENTATION

ƒ LINEAR

ƒ Components for Hardware ƒ Connect Simple Filters Together to Build More Complicated Systems 8/22/2003

© 2003, JH McClellan & RW Schafer

3

OVERVIEW

ƒ GENERAL PROPERTIES of FILTERS ƒ ƒ ƒ

© 2003, JH McClellan & RW Schafer

and

TIME-INVARIANT

ƒ ALL LTI systems have h[n] & use convolution 4

8/22/2003

© 2003, JH McClellan & RW Schafer

5

DIGITAL FILTERING x(t)

A-to-D

x[n]

BUILDING BLOCKS

y[n]

FILTER

D-to-A

y(t)

x[n]

OUTPUT

FILTER

FILTER INPUT

ƒ CONCENTRATE on the FILTER (DSP)

ƒ BUILD UP COMPLICATED FILTERS

ƒ FUNCTIONS of n, the “time index” ƒ INPUT x[n] ƒ OUTPUT y[n]

ƒ FROM SIMPLE MODULES ƒ Ex: FILTER MODULE MIGHT BE 3-pt FIR 6

© 2003, JH McClellan & RW Schafer

+

FILTER

ƒ DISCRETE-TIME SIGNALS

8/22/2003

y[n]

+

8/22/2003

7

© 2003, JH McClellan & RW Schafer

GENERAL FIR FILTER

MATLAB for FIR FILTER

ƒ FILTER COEFFICIENTS {bk}

ƒ yy = conv(bb,xx) ƒ VECTOR bb contains Filter Coefficients ƒ DSP-First: yy = firfilt(bb,xx)

ƒ DEFINE THE FILTER

M

y[n ] = ∑ bk x[n − k ] k =0

ƒ For example, bk = {3, − 1, 2,1}

ƒ FILTER COEFFICIENTS {bk}

3

M

y[n ] = ∑ bk x[n − k ]

y[n ] = ∑ bk x[n − k ]

k =0

© 2003, JH McClellan & RW Schafer

for images

k =0

= 3x[n ] − x[n − 1] + 2 x[n − 2] + x[n − 3] 8/22/2003

conv2()

8

8/22/2003

© 2003, JH McClellan & RW Schafer

9

SPECIAL INPUT SIGNALS

FIR IMPULSE RESPONSE

ƒ x[n] = SINUSOID FREQUENCY RESPONSE ƒ x[n] has only one NON-ZERO VALUE

ƒ Convolution = Filter Definition ƒ Filter Coeffs = Impulse Response

1 n = 0 δ [n ] =  0 n ≠ 0 UNIT-IMPULSE

1

M M

hy[n ] = ∑ bkkδx[n − k ]

n 8/22/2003

kk==00

10

© 2003, JH McClellan & RW Schafer

8/22/2003

11

© 2003, JH McClellan & RW Schafer

MATH FORMULA for h[n]

LTI: Convolution Sum

ƒ Use SHIFTED IMPULSES to write h[n] h[n ] = δ [n ] − δ [n − 1] + 2δ [n − 2] − δ [n − 3] + δ [n − 4]

ƒ Output = Convolution of x[n] & h[n] ƒ NOTATION: y[n ] = h[n ] ∗ x[n ]

2

h[n ]

ƒ Here is the FIR case: FINITE LIMITS

1 0

bk = { 1, − 1, 2, − 1, 1 } 8/22/2003

M

4

y[n ] = ∑ h[k ]x[n − k ]

n

k =0

–1 © 2003, JH McClellan & RW Schafer

FINITE LIMITS

Same as bk 12

8/22/2003

© 2003, JH McClellan & RW Schafer

13

CONVOLUTION Example

GENERAL FIR FILTER

h[n ] = δ [n ] − δ [n − 1] + 2δ [n − 2] − δ [n − 3] + δ [n − 4] x[n ] = u[n ]

ƒ SLIDE a Length-L WINDOW over x[n]

n −1 0

1

2

3

4

5

6

7

x[n] h[n]

0 0

1 1 1 −1

1 1 2 −1

1 1

1 0

1 0

... 0

h[0] x[n ] h[1] x[n − 1] h[2]x[n − 2] h[3]x[n − 3] h[4]x[n − 4]

0

1

1

1

1

1

1

y[n]

0

8/22/2003

0 0

1

1

−1 −1 −1 −1 −1 −1 −1

0 0 0 0

0 0

2 2 2 2 2 2 0 −1 −1 −1 −1 −1

0 0

0

0

0

1

1

1

1

0

2

1

2

2

2

...

1

© 2003, JH McClellan & RW Schafer

x[n-M] 14

DCONVDEMO: MATLAB GUI

8/22/2003

x[n] © 2003, JH McClellan & RW Schafer

15

POP QUIZ ƒ FIR Filter is “FIRST DIFFERENCE” ƒ y[n] = x[n] - x[n-1]

ƒ INPUT is “UNIT STEP” 1 n ≥ 0 u[n ] =  0 n < 0

ƒ Find y[n] 8/22/2003

© 2003, JH McClellan & RW Schafer

16

8/22/2003

y[n ] = u[n ] − u[n − 1] = δ [n ] © 2003, JH McClellan & RW Schafer

17

HARDWARE STRUCTURES x[n]

FILTER

y[n]

HARDWARE ATOMS

M

y[n ] = ∑ bk x[n − k ]

ƒ Add, Multiply & Store

M

y[n ] = ∑ bk x[n − k ] k =0

k =0

ƒ INTERNAL STRUCTURE of “FILTER” ƒ WHAT COMPONENTS ARE NEEDED? ƒ HOW DO WE “HOOK” THEM TOGETHER?

y[n ] = x1[n ] + x2 [n ]

y[n ] = β x[n ]

ƒ SIGNAL FLOW GRAPH NOTATION 8/22/2003

18

© 2003, JH McClellan & RW Schafer

SIGNAL FLOW GRAPH

19

© 2003, JH McClellan & RW Schafer

Moore’s Law for TI DSPs

FIR STRUCTURE ƒ Direct Form

y[n ] = x[n − 1]

8/22/2003

M

LOG SCALE

y[n ] = ∑ bk x[n − k ] k =0

Double every 18 months ?

8/22/2003

© 2003, JH McClellan & RW Schafer

20

8/22/2003

© 2003, JH McClellan & RW Schafer

21

SYSTEM PROPERTIES x[n]

ƒ ƒ ƒ ƒ

SYSTEM

TIME-INVARIANCE ƒ IDEA:

y[n]

ƒ “Time-Shifting the input will cause the same time-shift in the output”

MATHEMATICAL DESCRIPTION TIME-INVARIANCE LINEARITY CAUSALITY

ƒ EQUIVALENTLY, ƒ We can prove that ƒ The time origin (n=0) is picked arbitrary

ƒ “No output prior to input” 8/22/2003

© 2003, JH McClellan & RW Schafer

22

TESTING Time-Invariance

8/22/2003

© 2003, JH McClellan & RW Schafer

23

LINEAR SYSTEM ƒ LINEARITY = Two Properties ƒ SCALING ƒ “Doubling x[n] will double y[n]”

ƒ SUPERPOSITION: ƒ “Adding two inputs gives an output that is the sum of the individual outputs”

8/22/2003

© 2003, JH McClellan & RW Schafer

24

8/22/2003

© 2003, JH McClellan & RW Schafer

25

TESTING LINEARITY

LTI SYSTEMS ƒ LTI:

Linear & Time-Invariant

ƒ COMPLETELY CHARACTERIZED by: ƒ IMPULSE RESPONSE h[n] ƒ CONVOLUTION: y[n] = x[n]*h[n] ƒ The “rule”defining the system can ALWAYS be rewritten as convolution

ƒ FIR Example: h[n] is same as bk 8/22/2003

© 2003, JH McClellan & RW Schafer

26

POP QUIZ

8/22/2003

27

© 2003, JH McClellan & RW Schafer

CASCADE SYSTEMS

ƒ FIR Filter is “FIRST DIFFERENCE”

ƒ Does the order of S1 & S2 matter?

ƒ y[n] = x[n] - x[n -1]

ƒ NO, LTI SYSTEMS can be rearranged !!! ƒ WHAT ARE THE FILTER COEFFS? {bk}

ƒ Write output as a convolution ƒ Need impulse response

h[n ] = δ [n ] − δ [n − 1] ƒ Then, another way to compute the output:

y[n ] = (δ [n ] − δ [n − 1]) ∗ x[n ]

8/22/2003

© 2003, JH McClellan & RW Schafer

S1 28

8/22/2003

S2 © 2003, JH McClellan & RW Schafer

29

CASCADE EQUIVALENT ƒ Find “overall” h[n] for a cascade ?

S1

S2

S2 8/22/2003

S1 © 2003, JH McClellan & RW Schafer

30

READING ASSIGNMENTS

Signal Processing First

ƒ This Lecture: ƒ Chapter 6, Sections 6-1, 6-2, 6-3, 6-4, & 6-5

Lecture 12 Frequency Response of FIR Filters

ƒ Other Reading: ƒ Recitation: Chapter 6 ƒ FREQUENCY RESPONSE EXAMPLES

ƒ Next Lecture: Chap. 6, Sects. 6-6, 6-7 & 6-8

2/25/2005

© 2003, JH McClellan & RW Schafer

2/25/2005

1

LECTURE OBJECTIVES

ƒ Time-Domain: “n” = time ƒ x[n] ƒ x(t)

ƒ DETERMINE the FIR FILTER OUTPUT

ƒ PLOTTING vs. Frequency ƒ MAGNITUDE vs. Freq ƒ PHASE vs. Freq jωˆ

© 2003, JH McClellan & RW Schafer

discrete-time signal continuous-time signal

ƒ Frequency Domain (sum of sinusoids) MAG

ƒ Spectrum vs. f (Hz) • ANALOG vs. DIGITAL

PHASE

H ( e ) = H ( e jωˆ ) e j∠H ( e

2/25/2005

3

DOMAINS: Time & Frequency

ƒ SINUSOIDAL INPUT SIGNAL

ƒ FREQUENCY RESPONSE of FIR

© 2003, JH McClellan & RW Schafer

4

jωˆ

ƒ Spectrum vs. omega-hat )

ƒ Move back and forth QUICKLY 2/25/2005

© 2003, JH McClellan & RW Schafer

5

DIGITAL “FILTERING” x(t)

A-to-D

x[n]

FILTER

y[n]

ωˆ

FILTERING EXAMPLE

D-to-A

y(t)

ƒ 7-point AVERAGER ƒ Removes cosine

ƒ SINUSOIDAL INPUT

ƒ 3-point AVERAGER

ƒ INPUT x[n] = SUM of SINUSOIDS ƒ Then, OUTPUT y[n] = SUM of SINUSOIDS © 2003, JH McClellan & RW Schafer

ƒ Changes A slightly

8

3-pt AVG EXAMPLE Input : x[n ] = (1.02)n + cos(2π n / 8 + π / 4)

2/25/2005

2

y3[n ] = ∑ (13 )x[n − k ] k =0

© 2003, JH McClellan & RW Schafer

9

7-pt FIR EXAMPLE (AVG) for 0 ≤ n ≤ 40

Input : x[n ] = (1.02)n + cos(2π n / 8 + π / 4)

for 0 ≤ n ≤ 40

CAUSAL: Use Previous

USE PAST VALUES

2/25/2005

y7 [n ] = ∑ (17 )x[n − k ]

k =0 ƒ By making its amplitude (A) smaller

ωˆ

ƒ CONCENTRATE on the SPECTRUM

2/25/2005

6

© 2003, JH McClellan & RW Schafer

10

2/25/2005

© 2003, JH McClellan & RW Schafer

11

LONGER OUTPUT

DCONVDEMO: MATLAB GUI

SINUSOIDAL RESPONSE ƒ INPUT: x[n] = SINUSOID ƒ OUTPUT: y[n] will also be a SINUSOID ƒ Different Amplitude and Phase

ƒ SAME Frequency ƒ AMPLITUDE & PHASE CHANGE ƒ Called the FREQUENCY RESPONSE 2/25/2005

© 2003, JH McClellan & RW Schafer

12

COMPLEX EXPONENTIAL

x[n ] = Ae jϕ e jωˆ n

2/25/2005

ƒ Use the FIR “Difference Equation”

k =0

k =0

M

M

k =0

k =0

y[n ] = ∑ bk x[n − k ] = ∑ bk Ae jϕ e jωˆ ( n −k )

x[n] is the input signal—a complex exponential

M

13

COMPLEX EXP OUTPUT

−∞
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF