signals, instruments, and systems – w5 introduction to signal … · 2016. 3. 23. · a f g af g...

50
Signals, Instruments, and Systems – W5 Introduction to Signal Processing – Convolution, Sampling, Reconstruction 1

Upload: others

Post on 16-Aug-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Signals, Instruments, and Systems – W5

Introduction to Signal Processing – Convolution, Sampling, Reconstruction

1

Page 2: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Motivation from Week 1 Lecture

2

Sensing

Processing Communication

Processing

Mobility

In-situ instrument

Visualization

Storing

Transportation channel Base station

Highlighted blocks are those mainly leveraging the content of this lecture.

Page 3: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Convolution

3

Page 4: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Convolution

dtgftgf )()()(

• For each value of t:1. Flip (reflect) g2. Shift g by t3. Multiply f and g4. Integrate over

• Note that the result does not depend on !

dtgf

tgftgg

gg

)()( 4)

)()( 3))()( 2)

)()( 1)

4

Page 5: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

[Matlab demo “cconvdemo”]

http://users.ece.gatech.edu/mcclella/matlabGUIs/5

Page 6: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Examples

=-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

*-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

1.2

1.4

6

Page 7: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Examples

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

*-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

=

7

Page 8: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Examples

=-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

*-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

8

Page 9: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Examples

=-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

*-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

9

Page 10: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Examples

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

*-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0.2

0.4

0.6

0.8

1

=

10

Page 11: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Convolution in Time and Frequency Domains

11

))(ˆˆ()(ˆ)()()(

)(ˆ)(ˆ)(ˆ))(()(

gfhtgtfth

gfhtgfth

Time domain Frequency domain

Ord

inar

yfr

eque

ncy

))((21)()()()(

)()()())(()(

GFHtgtfth

GFHtgfth

Ang

ular

freq

uenc

y

Page 12: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Convolution Properties

)()()(

)()()(

)()(

agfgafgfa

hfgfhgf

hgfhgf

fggf

tionmultiplica scalar ity withAssociativ

vityDistributi

ityAssociativ

ityCommutativ

12

Page 13: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Discrete Convolution

m

mngmfngf

dtgftgf

][][][

)()()(

Notes:• Similar to the continuous version• The integral becomes an infinite sum• Matlab, operating on a computer (i.e. a digital device) can only emulate

continuity and therefore use the discrete version with an adjustable discretization level (in time and amplitude) and finite bounds of the convolution window 13

Page 14: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

[Matlab demo “dconvdemo”]

http://users.ece.gatech.edu/mcclella/matlabGUIs/14

Page 15: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Sampling

15

Page 16: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

• Digital– Discrete– Digital world

Analog – Digital

• Analog– Continuous– Real world

0 100 200 300 400 500 600 700 800 900 1000-4

-2

0

2

4

6

8

10

Time

Sig

nal A

mpl

itude

Time0 100 200 300 400 500 600 700 800 900 1000

-4

-2

0

2

4

6

8

10

Sig

nal A

mpl

itude

16

Page 17: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Train of Dirac Impulses

17

n

nTttx )()(

Page 18: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Train of Dirac Impulses

18

n

T

T

tjk

n

Tk

TX

Tdtetx

Tatx

nTttx

22)(

1)(1)(

)()(

2/

2/

0

Time domain Frequency domain

F()

Page 19: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Sampling in Time Domain

19

nnp

n

nTtnTxnTttxtptxtx

nTttp

tx

)()()()()()()(

)()(

)(

Train of Dirac pulses

T = sampling periodf = 1/T = sampling

frequency

Page 20: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Sampling in Frequency Domain

20

kS

kSp

kS

p

p

kXT

kXT

X

kT

P

PXX

tptxtx

)(1

)(*)(1)(

)(2)(

)(*)(21)(

)()()(

Ts 2

Samplingfrequency

Convolution propertyTime domain

Frequency domain

Page 21: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Sampling a Band-Limited Signal

21

kS

p

kXT

PXX

)(1

)(*)(21)(

k

SkT

P )(2)(

X(ω) → spectrum of signal x(t) with highest frequency < ωm

Sampling frequency ωs > 2 ωm

Page 22: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Sampling a Band-Limited Signal

22

X(ξ) → spectrum of signal x(t) with highest frequency < 2 kHz

Sampling frequency: 5 kHz > 2 * 2 kHz

Page 23: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Sampling a Band-Limited Signal

23

X(ξ) → spectrum of signal x(t) with highest frequency < 3 kHz

Sampling frequency: 5 kHz < 2 * 3 kHz

Page 24: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

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

-1.5

-1

-0.5

0

0.5

1

1.5

Time [s]

Original Signal

)52sin(2.0)22sin(4.0)2sin()( ttttf 24

Page 25: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

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

-1.5

-1

-0.5

0

0.5

1

1.5

Time [s]

Too Few Samples (1Hz)

→ Data is lost25

Page 26: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

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

-1.5

-1

-0.5

0

0.5

1

1.5

Time [s]

Too Many Samples (100 Hz)

→Redundant data→Increase of data size

26

Page 27: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

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

-1.5

-1

-0.5

0

0.5

1

1.5

Time [s]

Minimal Possible Sampling (> 10 Hz)

27

Page 28: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Nyquist–Shannon Theorem• If a function x(t) contains no frequencies higher than

B Hz, it is completely determined by giving its coordinates at a series of points spaced 1/(2B) seconds apart.

• Sampling frequency must be at least two times greater than the maximal signal frequency

28

Page 29: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Sampling in Practice

• Sampling frequency two times greater than maximal frequency is the limit

• If possible, try to use a sampling frequency 10 times greater than the maximal frequency

• Audio CD, sampling at 44.1 kHzMaximal hearable frequency: 20 kHz

29

Page 30: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Signal Reconstruction

30

Page 31: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

31

spectrum of original signal

spectrum of reconstructedsignal

)(tx x

n

nTttp )(

)(txr)(H

spectrum of sampled signalsampling frequency ωs > 2 ωm

filtering filter cut-off frequency ωm < ωc < (ωs –ωm)

If there is no overlap between the shifted spectra the signal xr(t) can beperfectly reconstructed from x(t)

)(txp

)()()( HXX pr

Page 32: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

32

spectrum of original signal

spectrum of reconstructedsignal

)(tx x

n

nTttp )(

)(txr)(H

spectrum of sampled signalsampling frequency fs < 2 fm

filtering filter cut-off frequency fcfm < fc < (fs –fm)

If there is overlap between the shifted spectra the signal xr(t) cannot beperfectly reconstructed from x(t)

)(txp

)()()( HXX pr

Page 33: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

)(tx x

n

nTttp )(

)(txr

Time Domain Interpretationof Signal Reconstruction

ωm < ωc < (ωs –ωm)

nTt

nTtTnTx

nTthnTx

thnTtnTx

thtxtx

c

n

n

n

pr

sin

)(*

)(*)()(

t

tTth c

sin)( with

F-1()

The lowpass filter interpolates the samples assuming x(t) contains no energy at frequencies > ωc(ωc =cutoff frequency)

33

Page 34: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

34From Prof. A. S. Willsky, Signals and Systems course

Page 35: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Signal Reconstruction Methods

snss

s

s

ns

TtnTtnTxtx

TnTtnTxtx

sinc)()()(

sinc)()(

• Signal has to be band limited (i.e. Fourier transform for frequencies greater than B equal 0)

• The sampling rate must exceed twice the bandwidth, 2B

BTs 2

1

35

Bfs 2or

1. Zero-order hold2. First-order hold – linear interpolation 3. Whittaker-Shannon interpolation (bandlimited interpolation):

(Alternative equivalent formulation)

Page 36: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

36From Prof. A. S. Willsky, Signals and Systems course

Page 37: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Aliasing

37

Page 38: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

No Problems in Reconstruction

38

Page 39: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Reconstruction Problems

Alias

Overlapping

39

Page 40: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Harmonics

Fundamental Frequency

40

Page 41: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5-1

-0.5

0

0.5

1

Time [s]

1Hz2Hz3Hz4Hz

Harmonics

41

Page 42: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

La-Tone (440 Hz) sampled at 44.1 kHz (CD standard)

42

Page 43: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

La-Tone (440 Hz) sampled at 2 kHz without filtering

43

Page 44: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

La-Tone (440Hz) sampled at 2 kHz filtered at 1 kHz

44

Page 45: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Aliasing Audio Examples

Original sound Aliases 4 kHz Correct sampling 4 kHz

45

Page 46: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Moiré Pattern

46

Page 47: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

47

Aliasing Video Examples

http://www.youtube.com/watch?v=jHS9JGkEOmA

https://www.youtube.com/watch?v=R-IVw8OKjvQ

Page 48: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Conclusion

48

Page 49: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Take Home Messages

When you sample a signal …

1. Make sure you know what the maximum frequency fmax is or enforce it through a low-pass filter

2. Make sure you sample at fs > 2 fmax(Nyquist rule)

49

Page 50: Signals, Instruments, and Systems – W5 Introduction to Signal … · 2016. 3. 23. · a f g af g f ag f g h f g f h f g h f ... • Matlab, operating on a computer (i.e. a digital

Books:• Ronald W. Schafer and James H. McClellan

“DSP First: A Multimedia Approach”, 1998• A. Oppenheim and A. S. Willsky with S. Hamid,

“Signals and Systems”, Prentice Hall, 1996.

50

Additional Literature – Week 5