Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1...

52
Introduction to DSP Source: http://www.dspguide.com Free textbook on DSP 1 Version 2

Transcript of Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1...

Page 1: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Introduction to DSP

Source: http://www.dspguide.com Free textbook on DSP

1 Version 2

Page 2: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Digital Signal Processing

• Key aspect is signals • Signals acquired from the environment

through sensors • Digitized through ADCs • DSP answers “what next”?

2

Page 3: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

DSP Roots

3

Page 4: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

DSP overlaps with many fields…

4

Page 5: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Signals and Systems

• Signal – Description of how one parameter varies with another parameter – Voltage vs. time – Brightness vs. distance

• System – Any process that produces output signal in response to an input signal

5

Page 6: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Continuous and Discrete systems

6

Page 7: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Understanding a System

• We need to understand a system i.e., how it transforms the input signal to generate an output signal

• Examples: – How to remove noise from an ECG – How does telephone line transmit your voice

signal and changes along the way… • Too many systems with varied characteristics

– Is it really possible?

7

Page 8: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Linear System

• Fortunately, many useful systems are linear in nature

• They possess properties that make them amenable to be abstracted and studied

• What properties make a system linear?

8

Page 9: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Linear System

• A linear system satisfies two mathematical properties: – Homogeneity – Additivity

• If we show that a system exhibits the above two properties, then we prove that the system is linear

• A third property known as shift invariance is not required for linear system but usually satisfied

• It is mandatory of linear systems for DSP

9

Page 10: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Homogeneity

10

Page 11: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Additivity

11

Page 12: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Shift Invariance

12

Page 13: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Additional Properties

• Unfortunately, the three properties of linear systems, namely, homogeneity, additivity, and shift invariance are not enough to understand/study linear systems

• Two additional properties usually displayed by linear systems – Static linearity – Sinusoidal fidelity

13

Page 14: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Static Linearity • defines how a linear system reacts when the signals aren't changing, i.e.,

when they are DC or static. • static response of a linear system is very simple: the output is the input

multiplied by a constant. • All linear systems have static linearity, the opposite is not always true

14

Page 15: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Examples of Static nonlinearity

15

Page 16: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Sinusoidal Fidelity

• Important characteristic exhibited by linear systems

• If the input to a linear system is a sinusoidal wave, the output will also be a sinusoidal wave, and at exactly the same frequency as the input.

• However, the output may differ in amplitude and phase

16

Page 17: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Examples of Linear Systems

17

Page 18: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Examples of Non-linear systems

18

Page 19: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Special Properties of Linearity

• Linearity is commutative

19

Page 20: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Special Properties of Linearity

• A system with multiple inputs and/or outputs will be linear if it is composed of linear subsystems and additions of signals. The complexity does not matter, only that nothing nonlinear is allowed inside of the system.

20

Page 21: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Multiply Operation

• With a constant is linear… • Multiplication of two signals is non-linear

21

Page 22: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Synthesis & Decomposition

22

Page 23: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Superposition – Foundation

of DSP

23

Page 24: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Common Decompositions

• Using Impulses Impulse=single non zero

value in a sequence of zeroes

δ[n] δ[n-s]

• Using Step signals

24

0 s

Page 25: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

25

Page 26: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Fourier Decomposition

• Not very obvious • N-point signal decomposed to N+2 signals • Half are sine waves • Half are cosine waves

26

Page 27: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Fourier Decomposition

27

Page 28: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Convolution

• Convolution is a mathematical way of combining two signals to form a third signal

• The most important concept in DSP • Input and impulse response are combined to

compute the output signal

28

Page 29: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Impulse Response of a Linear System

29

Page 30: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Computing output signal

Question: If a linear system has an impulse response of h[n] then compute the output for -3*δ[n-8]

Answer: If δ[n] gives output h[n] then δ[n-8] gives output h[n-8] … shift invariant

and -3* δ[n-8] gives output 3*h[n-8] … homogeneity

30

Page 31: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Computing Output Response

Given an input signal, we can compute the output of a linear system if we know its impulse response

Step 1: Decompose signal into sum of scaled and shifted impulses

Step 2: Compute output for each scaled and shifted impulse input

Step 3: Add all the output signals

31

Page 32: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Convolution

• Is another mathematical operation just like add, subtract, multiply

• Represented by * (asterisk) • y[n] = x[n] * h[n] • “x[n] is convolved with h[n] to produce y[n]”

32

Page 33: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Filtering Example

33

Input = Sine wave

(High Frequency) +

Ramp (Low Frequency)

Page 34: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

More Examples

34

Page 35: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Input and Output Lengths • Output Length = Input Length + Impulse Length – 1

• Usually Impulse length is very short (~100) • While input can be very large (~millions of samples)

35

= 81 + 31 – 1 = 111

= 81 + 31 – 1 = 111

Page 36: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Understanding Convolution

• We can understand from the perspective of – Input Signal (Input side algorithm) – Output Signal (Output side algorithm)

36

Page 37: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Input Side Algorithm

• This first viewpoint of convolution is based on the fundamental concept of DSP – decompose the input, – pass the components through the system, – and synthesize the output.

37

Page 38: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Input Side Algorithm – An illustrative example

38

Page 39: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

39

Page 40: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Same example – input and impulse response swapped

40

We observe that we get the

same output

Convolution Is commutative

Page 41: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Output Side Algorithm

• Input side perspective answers the following question – How does each input sample contribute to the

output? – This approach is not a natural way of computing

output • Output side perspective tries to answer the

following question – For each output sample, what input samples

contribute to its generation? – This approach is more natural

41

Page 42: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Example revisited

42

Which inputs contribute to output y[6]? To answer this, we can look at sample 6 in each plot We see that X[3], x[4], x[5], and x[6] contribute to y[6] i.e., y[6]=x[3]h[3] + x[4]h[2] + x[5]h[1] + x[6]h[0]

Page 43: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Example revisited

• y[6] = x[3]h[3] + x[4]h[2] + x[5]h[1] + x[6]h[0] • Note that samples of h in the above equation

are in decreasing order • While input samples are in an increasing order • From the output perspective, thus, the

impulse response is “flipped”

43

Page 44: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

44

Page 45: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

45

Samples Not Available!!

Page 46: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

46

Samples Not Available!!

Page 47: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Convolution – Mathematical Formula

47

Page 48: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

End effects of convolution

48

Page 49: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Convolution - Applications

• A linear system's characteristics are completely specified by the system's impulse response, as governed by the mathematics of convolution

• The above is the basis for many signal processing techniques

• Examples – Filters – systems with appropriate impulse response – Enemy aircraft detected by radar by analyzing measured

impulse response – Echo suppression in long distance phone calls

• Create impulse response that counteracts impulse response of echo

49

Page 50: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

50

Page 51: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

Example Low Pass Filter Kernels

• Kernel another word for Impulse Response

51

Page 52: Introduction to DSP - msvincognito.nl · Introduction to DSP . Source: . Free textbook on DSP . 1 Version 2

High Pass Filter Kernels

52