dsp first, 2e...dsp first, 2e author: mcclellan/schafer/yoder subject: engineering computer science...

12
DSP First Second Edition Chapter 2 Sinusoids Copyright © 2016, 1998 Pearson Education, Inc. All Rights Reserved TLH LECTURE 2_2 Section 2-3.2, 2-4

Upload: others

Post on 22-Mar-2020

34 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

DSP First

Second Edition

Chapter 2

Sinusoids

Copyright © 2016, 1998 Pearson Education, Inc. All Rights Reserved

TLH LECTURE 2_2

Section 2-3.2, 2-4

Page 2: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

Aug 2016 © 2003-2016, JH McClellan & RW Schafer 2

PLOTTING COSINE SIGNAL

from the FORMULA

Determine period:

Determine a peak location by solving

Peak at t=-4

)2.13.0cos(5 t

02.13.0

0)(

t

t

3/203.0/2/2 T

Page 3: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

Aug 2016 © 2003-2016, JH McClellan & RW Schafer 3

TIME-SHIFT

In a mathematical formula we can replace

t with t-tm

Thus the t=0 point moves to t=tm

Peak value of cos((t-tm)) is now at t=tm

))(cos()( mm ttAttx

Page 4: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

Aug 2016 © 2003-2016, JH McClellan & RW Schafer 4

PHASE TIME-SHIFT

Equate the formulas:

and we obtain:

or,

)cos())(cos( tAttA m

mt

mt

Page 5: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

Aug 2016 © 2003-2016, JH McClellan & RW Schafer 5

(A, , f) from a PLOT

25.0))(200( mm tt

20001.0

22 T100

1period1

sec01.0 T

sec00125.0mt

Page 6: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

Aug 2016 © 2003-2016, JH McClellan & RW Schafer 6

(A, , f) from a PLOT

25.0))(200( mm tt

20001.0

22 T100

1period1

sec01.0 T

sec00125.0mt

Page 7: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

Aug 2016 © 2003-2016, JH McClellan & RW Schafer 7

(A, , f) from a PLOT

25.0))(200( mm tt

20001.0

22 T100

1period1

sec01.0 T

sec00125.0mt

Page 8: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

Attenuation

Aug 2016 © 2003-2016, JH McClellan & RW Schafer 8

)cos()( tAtx

In real waves, there will always be a certain degree of

attenuation, which is the reduction of the signal amplitude

over time and/or over distance.

In a sinusoid, A is a constant.

)cos()( / tAetx t

/)( tAetA

2/)2()( tetAHowever, the amplitude can

have exponential decay, e.g.,

Page 9: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

MATLAB Example (I)

Aug 2016 © 2003-2016, JH McClellan & RW Schafer 9

Generating sinusoids in MATLAB is easy:

% define how many values in a second

fs = 8000;

% define array tt for time

% time runs from -1s to +3.2s

% sampled at an interval of 1/fs

tt = -1 : 1/fs : 3.2;

xx = 2.1 * cos(2*pi*440*tt + 0.4*pi);

)4.0880cos(1.2)( ttx

The array xx then contains a “sampled” signal of:

Page 10: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

MATLAB Example (II)

Aug 2016 © 2003-2016, JH McClellan & RW Schafer 10

Introducing attenuation with time

% fs defines how many values per second

fs = 8000;

tt = -1 : 1/fs : 3.2;

yy = exp(-abs(tt)*1.2);% exponential decay

yy = xx.*yy;

soundsc(yy,fs)

)4.0880cos(1.2)( ||2.1 tety t

Array yy contains a signal with changing amplitude:

Soundsc lets you hear the signal yy

Page 11: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

Plotting the Signal

Aug 2016 © 2003-2016, JH McClellan & RW Schafer 11

Waveform “envelope”

a short slice

Page 12: DSP First, 2e...DSP First, 2e Author: McClellan/Schafer/Yoder Subject: Engineering Computer Science Keywords: Engineering Computer Science Created Date: 1/22/2019 3:42:12 PM

Copyright © 2016, 1998 Pearson Education, Inc. All Rights Reserved

Figure 2-9: Plotting the 40-hz Sampled Cosine 2.8(b)

for (A) s s0 005 ; (B) T 0 0025 S;(C) T 0 0005 S

sT S

Page 20