signal processing fundamentals - eieenpklun/eie327/intro.pdf1 the hong kong polytechnic university...

35
1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 EIE 327 Signal Processing Fundamentals Signal Processing Fundamentals Part I: Spectrum Analysis and Filtering Part I: Spectrum Analysis and Filtering Dr Daniel Dr Daniel Lun Lun , EIE , EIE Part II: Statistical Signal Processing Part II: Statistical Signal Processing Dr Bonnie Law, EIE Dr Bonnie Law, EIE

Upload: vuonganh

Post on 01-Apr-2018

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

1

THE HONG KONG POLYTECHNIC UNIVERSITYDepartment of Electronic and Information Engineering

EIE 327EIE 327

Signal Processing FundamentalsSignal Processing Fundamentals

Part I: Spectrum Analysis and Filtering Part I: Spectrum Analysis and Filtering –– Dr Daniel Dr Daniel LunLun, EIE, EIE

Part II: Statistical Signal ProcessingPart II: Statistical Signal Processing–– Dr Bonnie Law, EIEDr Bonnie Law, EIE

Page 2: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

2

THE HONG KONG POLYTECHNIC UNIVERSITYDepartment of Electronic and Information Engineering

EIE 327EIE 327Signal Processing Fundamentals Signal Processing Fundamentals

PartPart--IISpectrum Analysis and Filtering Spectrum Analysis and Filtering

Lecturer:Lecturer: Dr. Daniel PakDr. Daniel Pak--Kong LUNKong LUN

Room:Room: DE637DE637 Tel:Tel: 2766625527666255EE--Mail:Mail: enpklunenpklun@@polyupolyu..eduedu..hkhkWeb page:Web page: www.www.eieeie..polyupolyu..eduedu..hkhk/~/~enpklunenpklun/EIE327//EIE327/

EIE327.htmlEIE327.html

Page 3: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

3

THE HONG KONG POLYTECHNIC UNIVERSITYDepartment of Electronic and Information Engineering

Contents• Signals and Systems• Sinusoids and Complex Numbers• Spectrum Representation• Sampling and Aliasing• Fourier Transform and Spectrum Analysis• Fast Fourier Transform• Convolution, FIR Filters and Z-transform

Page 4: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

4

THE HONG KONG POLYTECHNIC UNIVERSITYDepartment of Electronic and Information Engineering

References• DSP First – A Multimedia Approach

J.H. McClellan, R.W. Schafer and M.A. YoderPrentice Hall, 1998Comment: Entry level with lots of multimedia illustrations

• Introduction to Digital Signal ProcessingA.L. Paul and W. FuerstJohn Wiley and Sons Inc, 2nd Ed. 1998Comment: More formal treatment

Page 5: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

5

1. 1. Signals and SystemsSignals and Systems

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Input Output

Page 6: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

6

What is Signal?“Something” that carries information

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

“Something” ⇒ pattern of variations of physical quantity that can be manipulated, stored, or transmitted by physical process

e.g. Speech signals, audio signals, image signals, video signals, radar signals, etc.

Page 7: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

7

Examples of Signals

Speech Audio

Image

Video Multimedia

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Page 8: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

8

• Signals can change to other physical form, e.g. electricity

wave

change of voltage

mic

Light

Lens

CCD

Object

change of voltage

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Facilitate processing by electrical equipment

Facilitate processing by electrical equipment

Page 9: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

9

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Continuous-time Signals• Many signals can be considered as pattern

changing with time, e.g. speech

• For every time instant, signal is found• Hence continuous-time signal (or analogue signal)• Most natural signals, such as speech, audio, etc.

are continuous-time signals

timevoltage

Page 10: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

10

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Discrete-time Signals• With the advance of computer technology,

we want to process signals by computer• Computer can only handle data, but not

continuous signals• Need sampling⇒ extract signal at some time instants

timevoltage Signal is found only at some instantsDiscrete-time signal

244.2

Page 11: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

11

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Typical Signal Processing Systems

Mic

Sound card with sampler(or A/D converter)

Processed signalD/A converter speaker

Page 12: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

12

Why signal processing?• Change the signal characteristic

• e.g. increase or decrease the loudness of speech• Signals in their original form may not be

manipulated easily• e.g. Speech compression – reduce the effort for

storage and transmission of speech• To understand the signal

• e.g. Speech recognition – to recognize the content of the speech

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Since we often process discrete-time signals, such processing is called digital signal processing (DSP)

Since we often process discrete-time signals, such processing is called digital signal processing (DSP)

Page 13: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

13

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Examples of DSP Systems

Video Object tracking system

Speech compression

system

10 times compressed

Page 14: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

14

Steps to construct a DSP system

1. Develop signal processing algorithm• Express input and output in mathematical form• Using mathematics to figure out the solution to

the problem2. Realize the signal processing algorithm

• Translate the algorithm into computer program• Execute the program with the computer

Input Output

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Page 15: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

15

Mathematic Representation of Continuous-time Signals

x(t)

x: a symbol represents this signal

t: a real number variable

x(t) is defined for all value of t, hence continuouse.g. x(0) = 0; x(70.5) = -90.5; x(100.23) = 80

t = 100.23

t = 70.5t = 0

We use () to indicate that x is continuous

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Page 16: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

16

Mathematic Representation of Discrete-time Signals

x[n]

x: a symbol represents this signal

n: an integer variable

We use [] to indicate that x is discrete

n = 0

n = 100

n = 70

x[n] is defined only at some instants of time, since n is integer

e.g. x[0] = 0; x[70] = -90.5; x[100] = 80

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Page 17: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

17

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Ts

x(t)

x[n]

x[n] = x(n*Ts)x[n] = x(n*Ts)

x[0] = x(0)x[1] = x(Ts)x[2] = x(2Ts)x[3] = x(3Ts)

: :

Page 18: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

18

Simplest DSP System - Amplifier Input

(256 samples)

1. Develop signal processing algorithm• Input – x[n]; Output – y[n]• y[n] = x[n] × 2 for all n = 1 to 256 (algorithm)

2. Realize the signal processing algorithmmain() { int n, x[], y[];

for (n=1; n<=256; n++) y[n] = x[n]*2;}

Output(256 samples) Our task:

Output = Input x 2

Our task: Output = Input x 2

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Page 19: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

19

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Mathematic Representation of Systems

• A signal processing system transforms signals into new signals or different signal representations

• Mathematically

y(t) = T{x(t)}y(t) = T{x(t)}Output signal Input signal

System or Operator

• T, in this case, works on continuous-time signals, hence it is a continuous-time system

e.g. y(t) = 2*x(t)

Page 20: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

20

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Input Output

System T⇓

x 2

x[n] y[n]

⇒ y[n] = 2*x[n]

• T now works on discrete-time signals, hence it is a discrete-time system

y[n] = T{x[n]}y[n] = T{x[n]}

Page 21: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

21

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

1. Signals and Systems

Other Simple System Examples

System T⇓

sampling

x(t) y(t) = T{x(t)} = x(nTs)

System T⇓

square

x[n] y[n] = T{x[n]} = x[n]2

{0, 2, -1, -3, 4…} {0, 4, 1, 9, 16…}

Page 22: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

22

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

2. 2. Sinusoids and Complex NumbersSinusoids and Complex Numbers

Page 23: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

23

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

• Sinusoidal signals, or more concisely, sinusoids, are the most basic signals in signal processing

What are Sinusoids?

)tcos(A)t(x o φω +=

A continuous-time signal

Amplitudecosine function

radian frequency = 2π f

phase-shift

Page 24: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

24

)tcos(A)t(x o φω += ⇒ x(t) = 10 cos (2π1000t + 0)

• The signal above represents a cosine function with amplitude 10 and frequency 1000 Hz with no phase shift

e.g. x(0) = 10 cos(2π0) = 10x(0.5*10-3) = 10 cos(2π0.5) = -10x(1*10-3) = 10 cos(2π) = 10x(2*10-3) = 10 cos(2π2) = 10x(3*10-3) = 10 cos(2π3) = 10

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

Page 25: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

25

x(t) = 10 cos (2π1000t + 0)

x(t) = 5 cos (2π1000t + 0)

Change of Amplitude

Change of Amplitude

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

Page 26: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

26

Change of FrequencyChange of Frequency

x(t) = 10 cos (2π1000t + 0)

x(t) = 10 cos (2π500t + 0)

1 period = 2ms

1 period = 1ms

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

Page 27: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

27

Change of Phase shiftChange of Phase shift

x(t) = 10 cos (2π1000t + 0)

x(t) = 10 cos (2π1000t + pi/2)

Signal will shift 1 period if the cosine function advances by 2πHence shifting pi/2 means shifting ¼period

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

Page 28: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

28

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

Sinusoids are Real Signals• Although cosine are mathematical functions,

sinusoids can be generated by real instrument• e.g. Tuning fork

• Tuning fork vibrates in air at 440Hz and generates wave at the same frequency

Page 29: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

29

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

Why Sinusoids are so Important?• In 1807, a famous mathematician, Fourier, showed

that Almost all signals can be constructed by the summation of sinusoids of different frequencies, amplitudes and phase shifts

• The larger is the number of sinusoids, the closer is the square wave

Page 30: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

30

• The larger is the number of sinusoids, the closer is the waveform to square wave

A0+A1cos(ωot )

A0 + A1cos(ωot ) + A3cos(3ωot )

A0 + A1cos(ωot ) + A3cos(3ωot ) + A5cos(5ωot ) + A7cos(7ωot )

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

Page 31: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

31

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

• Sometimes, calculation involving cosine functions is not that convenient

1.7cos(2π10t + 70π /180) + 1.9cos (2π10t + 200π/180) = ???

• Solution: use complex numbers

jbaA +=

Complex number A The real

part of A

The imaginary part of A

1−=j

Phasor additionPhasor addition

Page 32: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

32

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

• Euler’s formula

θθθ sincos je j += { }θθ jeRecos =or

( ) ( )2211 coscos φωφω +++ tAtA• Consider

{ } { }( ){ } ( ){ }

{ } { }{ } ( )φωφω

ωφω

ωφφω

φωφω

+====

+=+=

+=

+

++

tAAeXeAee

XXeeAeAeeAeA

tj

tjjtj

tjjjtj

tjtj

cosReReRe

ReRe

ReRe

)(

2121

)(2

)(1

21

21

Phasors

X = X1 + X2

Page 33: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

33

1.7cos(2π10t + 70π /180) + 1.9cos (2π10t + 200π/180) = ???

597.15814.07.1 180/70

1

jeX j

+== π

6498.0785.19.1 180/200

2

jeX j

−−== π

180/79.14121

532.1

9476.0204.1πje

jXXX=

+−=+=

( )180/79.141102cos532.1: ππ +tSolution

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

Page 34: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

34

Exercise

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

( )( )4/31002cos4)(

4/1002cos8)(

2

1

ππππ

−=+=ttxttx

What is the sum of x1 and x2?

Page 35: Signal Processing Fundamentals - EIEenpklun/EIE327/Intro.pdf1 THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 327 Signal Processing Fundamentals

35

Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

2. Sinusoids and Complex Numbers

Solution

)7071.07071.0(88 4/

1

jeX j

+== π

)7071.07071.0(44 4/3

2

jeX j

−−== − π

4/21

4

)7071.07071.0(4πje

jXXX

=

+=+=

( )4/1002cos4: ππ +tSolution