Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing...

63
Digital Signal Processing (DSP) Signal Analysis Student Handouts: Course materials for this program are the sole property of Penn State Great Valley and cannot be reproduced or used for any purposes without the expressed consent of Penn State Great Valley.

Transcript of Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing...

Page 1: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Digital Signal Processing (DSP) Signal Analysis

Student Handouts: Course materials for this program are the sole property of Penn State Great Valley and cannot be reproduced or used for any purposes without the expressed consent of Penn State Great Valley.

Page 2: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

What we’ll cover today

§  Fourier Series §  Fourier Transforms §  Sampling and Aliasing §  Complex Signals § DFT § Matlab examples

Page 3: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Introduction

•  Analysis – Provides an explanation from observation. For example, you have a signal what can you say about the structure of that data. Or you know the input and the system, what can you say about the output?

•  Design – You know the input and the desired output, what system do you need to achieve the desired result. Often the information is limited and so there is no single right answer to the problem.

Page 4: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Introduction

Fourier  series

Fourier  Transform

Spectral  Analysis

Z-­‐transforms

Filter  Design

System  Design

• Analysis • Design

Page 5: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series • What is it?

Ø Periodic signals, signals that repeat for ever can be represented by a linear combination of sine waves and cosine waves Ø This representation is called a Fourier Series.

•  A French mathematician, Joseph Fourier (1786-1830) developed a powerful method for analyzing periodic waves.

Page 6: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series

• Periodic Wave

Page 7: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series

( ) ( )f t f t nT= +( ) ( )f t f t nT= +

f t f t nT⎛ ⎞⎛ ⎞⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠

= +

• A periodic signal is defined by

• where T is called the period and n is an integer

Page 8: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series

( )0 0cos 2 / sin 2 /k k

k kf t a kt T b kt Tπ π⎛ ⎞ ⎛ ⎞

⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠

∞ ∞

= == +∑ ∑

( )

( )0

0

2 cos 2 /

2 sin 2 /

Tk

Tk

a f t kt T dtTb f t kt T dtT

π

π

⎛ ⎞⎜ ⎟⎝ ⎠

⎛ ⎞⎜ ⎟⎝ ⎠

=

=

Where

• If f(t) is even, then the b’s are zero • If f(t) is odd, then the a’s are zero

Page 9: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series - Example

-4 -3 -2 -1 0 1 2 3 4-2

-1.5

-1

-0.5

0

0.5

1

1.5

2Periodic signal

Page 10: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series - Example 1

2 4( 1) 1,3,5,

0 0,2,4,0 0,1,2,3,4,

k

k

k

k

a kka kb k

π−

= − =

= =

= =

LLL

• Follow along as we do this problem with Matlab • What is T?

Page 11: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series Example

-4 -3 -2 -1 0 1 2 3 4-1.5

-1

-0.5

0

0.5

1

1.5 Approximation with 6 terms

time

Ampli

tude

Page 12: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series Complex Form

• Euler’s Relationship cos sin

cos 2sin 2

j

j j

j j

e j

e e

e ej

θ

θ θ

θ θ

θ θ

θ

θ

⎛ ⎞ ⎛ ⎞⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠

⎛ ⎞⎜ ⎟⎝ ⎠

⎛ ⎞⎜ ⎟⎝ ⎠

= +

+=

−=

1j= −

Page 13: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series - Complex Form

( )

( )

2 /

/2/

/2

12

j kt Tk

kT

j kt Tk kk

T

f t c e

a jbc f t eT

π

π

=−∞

=

−= =

• Each complex frequency is of form 2 pj f te π

Page 14: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series – Complex Form

• The magnitude of each frequency component

2 222 21 4 2

"Power" "Voltage"

k kk k k k

a bc c a b+= = +

• The phase of each frequency component is given by

arctan kk

k

baφ

⎛ ⎞⎜ ⎟⎜ ⎟⎜ ⎟⎝ ⎠

−=

Page 15: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series - Spectrum

• The spectrum of the Fourier Series is the magnitude and phase of the coefficients as a function of frequency. Example sin(2*pi*3*t).

-5 -4 -3 -2 -1 0 1 2 3 4 5-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1 "Voltage" Spectrum

Frequency Hz

Mag

nitud

e

c-1c1

-5 -4 -3 -2 -1 0 1 2 3 4 5-3

-2

-1

0

1

2

3

π/2

-π/2

Phase Spectrum

Frequency Hz

Pha

se

Page 16: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series - Spectrum

• Find the spectrum of the following two signals

cos 2 3tπ⎛ ⎞⎜ ⎟⎝ ⎠

sin 2 3 4t ππ⎛ ⎞⎜ ⎟⎜ ⎟⎝ ⎠

+

Page 17: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Series – Spectrum

-4T -3T -2T -T 0 T 2T 3T 4T-1

-0.5

0

0.5

1

1.5

2Pulse Train

• Compute the Complex Fourier Series for the following signal. The pulse width is 0.1*T.

Page 18: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Transform

• What happens when you do not have a periodic signal?

Ø Fourier Transform •  Generated from Fourier Series as the period becomes infinitely large. •  The interval between frequencies goes to zero. • Discrete spectrum becomes continuous

Page 19: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Transform

( ) ( )2 21 ( )2j ft j ft

a aF f f t e dt f t F f e dfπ ππ

⎛ ⎞⎜ ⎟⎝ ⎠

∞ ∞−

−∞ −∞= =∫ ∫

• The frequency f has units of Hertz or cycles per second. Also can be written in terms of radians (2*pi*f) as

( ) ( ) ( ) ( )j t j ta aF f t e dt f t F e dω ωω ω ω

∞ ∞−

−∞ −∞= =∫ ∫

Page 20: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Transform

• Find the Fourier Transform of

( ) 1, - 2 20, Elsewhere

T Ttf t⎧⎪⎪⎨⎪⎪⎩

≤ ≤=

• Find the inverse Fourier Transform of 0 02 2a

A AF f f f f fδ δ⎛ ⎞ ⎛ ⎞⎛ ⎞⎜ ⎟ ⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠ ⎝ ⎠

= − + +

• Where 0f fδ ⎛ ⎞⎜ ⎟⎝ ⎠− is the Dirac delta function

0 0g f f f g f dfδ⎛ ⎞ ⎛ ⎞ ⎛ ⎞⎜ ⎟⎜ ⎟ ⎜ ⎟⎝ ⎠⎝ ⎠ ⎝ ⎠

−∞= −∫

Page 21: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Transform of Sampled Data

•  Consider Notion of frequency in discrete world • Supposed that you had two signals,

( ) ( ) 61 2sin 2 and sin 2 10 f t t f t tπ π⎛ ⎞⎛ ⎞

⎜ ⎟⎜ ⎟⎝ ⎠ ⎝ ⎠

= =

• Say you sampled the first at a 10 Hz rate and the second at a 10 Megahertz rate. What would the data be?

Page 22: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Transform of Sampled Data

sin(2* *0.1* )nf nπ=

• In both cases the sampled signal is:

•  Thus a knowledge of the sampled data is not always sufficient. What else would clarify this?

Page 23: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Fourier Transform of Sampled Data

• If I know the sampling frequency, I would know the true frequency.

• Once data is sampled, the true frequency is lost. All that remains is the normalized frequency.

rns

ff f=

Page 24: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Discrete Time Functions •  A discrete time signal that is periodic with period M can be decomposed into a Fourier Series.

( ) ( )/2 1 /2 1

2 /2 /

/2 1 /2 1

1 and M M

j kn Mj kn Mk k

k M n Mx n c e c x nM

ππ

⎛ ⎞ ⎛ ⎞⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠

⎛ ⎞ ⎛ ⎞⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠

− −−

=− − =− −

= =∑ ∑

• A discrete-time aperiodic function has a Fourier Transform

( ) ( )1/2

2 2 2 2

1/2 and j f j fn j f j fn

d dnX e x n e x n X e e dfπ π π π⎛ ⎞ ⎛ ⎞

⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠

∞−

=−∞ −

= =∑ ∫

Page 25: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Discrete Fourier Transform ( ) ( )

1/22 2 2 2

1/2 and j f j fn j f j fn

d dnX e x n e x n X e e dfπ π π π⎛ ⎞ ⎛ ⎞

⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠

∞−

=−∞ −

= =∑ ∫

• Note that the limit of integration is -½ to ½. Why is that?

• Note that ( )2j fdX e π is periodic with period 1.

• Even though x(n) is not periodic, it’s Fourier Transform is.

Page 26: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Example

• Consider the following signal that has 21 non-zero values. Generate its Fourier Transform.

-(N-1)/2 0 N-1)/2-1

-0.5

0

0.5

1

1.5

2non-periodic pulse

Page 27: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Example • We will work it together and should get

2sin

sinj f

d

fNX e

π

π

⎛ ⎞⎜ ⎟⎛ ⎞ ⎝ ⎠⎜ ⎟⎜ ⎟ ⎛ ⎞⎝ ⎠ ⎜ ⎟⎝ ⎠

=

-0.5 -1/N 0 1/N 0.5

0

NDiscrete Fourier Transform of pulse

Page 28: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Summary • The Fourier transform of a discrete signal is continuous whenever the discrete time signal is non-periodic. • The real-world frequencies are effectively normalized by the sampling frequency resulting in normalized frequencies in the digital world. • The normalized frequencies are always between - ½ and ½. • The discrete Fourier transform is always periodic whether or not the discrete signal is periodic. If the discrete signal is periodic, the Fourier transform only exists at discrete frequencies. If the discrete signal is continuous, the Fourier transform is periodic. If you look beyond the - ½ to ½ interval, you will see the periodic extension of whatever is in the interval - ½ to ½. One can look over any period. Sometimes it is convenient to observe over the interval of 0 to 1 instead. • The interval - ½ to ½. Is called the Nyquist interval.

Page 29: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Sampling and Aliasing

-3

-2

-1

0

1

2

3

time

analo

g

-B 0 B

Xa(f)

-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

time

digital

-F_s -B 0 B F_s

Analog Fourier Transform

Discrete Discrete Fourier Transform

Page 30: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Aliasing • Aliasing occurs when the sampling rate is insufficient. It is a phenomena that is familiar to all.

• What happens with aliasing is that frequencies get mapped into lower frequencies.

• We will illustrate this using Matlab and a sinusoidal

Page 31: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Aliasing Example • We will take a f0= 2 Hertz sinusoidal and sample it at first a sampling frequency of 8*f0.

•  We will repeat it at a rate of 3*f0

• Finally, we will repeat it a rate of 7*f0/8

Page 32: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Example • Speech has rough bandwidth of 3 or 4 kHz and is sampled at 8 kHz. However the presence of noise beyond 4 kHz is a problem. The spectrum looks like:

0 2 4 6 8-0.5

0

0.5

1

1.5

Frequency in kHz

Analog frequency response of telephony siganl

Speech

Interference

Noise

Page 33: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Example

• Typical sampling rates for audio is 8K Hertz • Will that work? Why or why not? • What do we need to do?

Page 34: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Example

0 1 2 3 4 5 6 7 8-0.5

0

0.5

1

1.5 Antialiasing filter

Frequency in kHz

Filte

r gain

Page 35: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Example • In practice, this is not possible. You can not transition from 1 to 0 gain in 0 frequency. • We need a transition band •  Filter specs are often in dB units (20log10(gain)). Typical specs:

0 dB, 0 3.5 kHz40 dB, 4.5 kHz

Gain fGain f

= ≤ ≤≤− ≥

Page 36: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Example

• This filter is not practical: Ø High order – Virtually impossible for orders greater than 15. Ø Would be expensive and bulky. Ø Would introduce significant phase distortion.

Page 37: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

What is Phase Distortion

• Best understood in terms of music. Say you had a musical note composed of two frequencies say 4 and 6 KHz. When you filter that note, the 4 KHz and 6 KHz may differ in the time it takes to get through the filter. This create phase distortion

Page 38: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Phase Distortion

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5-1.5

-1

-0.5

0

0.5

1

1.5

time

original note

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5-1.5

-1

-0.5

0

0.5

1

1.5filter note with phase distortion

time

Page 39: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Example – How to solve the problem?

• Oversample, digital filter and decimate. Say we sample at a 32KHz rate and decimate by 4

ADC Hd(  f) Dec  by  4    Ha(f) x1(t) x2(t) x3(t) x4(t) x5(t)

Page 40: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

0 2 4 8 16 24 320

0.5

1

1.5

Ha(f)

Example – How to solve the problem

• Analog Filter clears out some of the noise, but the interference still is there.

Page 41: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Example: how to solve the Problem?

0 2 4 8 16 24 320

0.5

1

1.5

Fs/2

Hd(f)

• Digital filter eliminate the interference and noise without phase distortion.

Page 42: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Digital to Analog Reconstruction

DSP ADC DAC

• The digital to analog converter acts as a filter • If we put a sequence of {1,0,0,0,…} into the DAC we would get as an output:

Page 43: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Digital to Analog Converter

0 Ts0

0.5

1

1.5Impulse response of DAC

Page 44: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

DAC Frequency Response

0 Fs 2Fs 3Fs 4Fs 5Fs0

0.5

1

1.5

frequency

Page 45: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Digital to Analog Reconstruction

00

1

2

0 B0

1

2

00

0 B Fs 2Fs0

1

2

00

0 B Fs 2Fs0

1

2

00

1

2

0 B0

1

2

Page 46: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Reconstruction Filter

DAC Analog  LPF DigiBal  Interpolator

H1(f) HDAC(f) H2(f)

Page 47: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Reconstruction Filters

0 Fs 2Fs0

1

2

X_1(f

)

0 Fs 2Fs0

0.5

1

1.5

H_1(f

)

0 Fs 2Fs0

1

2

X_2(f

)

0 Fs 2Fs0

0.5

1

1.5

H_2(f

)

0 Fs 2Fs0

1

2

X_4(f

)

frequency

HDAC(f)

Page 48: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Complex Signals

• Complex signals play an important role in signal processing

( ) ( ) ( )r ix t x t jx t= +

• An alternative representation

( ) ( ) ( )

( ) ( )( )

2 2

1tan

r i

i

r

x t x t x t

x tx t

x t

⎛ ⎞⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎝ ⎠

= +

=

Page 49: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Complex Signals

• The complex signal can be written as ( ) ( ) ( ) ( )

j x tr ix t x t e x t jx t

⎛ ⎞⎜ ⎟⎜ ⎟⎝ ⎠= = +

• Complex sinusoidal ( ) ( )cos sinj te t j tω ω ω= +

-1 0 1-1

0

1

Real Signal

Imag

inary

signa

l

1

ω t

Page 50: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Frequency Response of Complex Sinusoidal

• Whereas real a sinusoidal of frequency f0 has energy at f0 and –f0. • Complex sinusoidal of frequency f0 has energy only at f0. • These complex signals play an important role in communications where the signals are bandlimited around some center frequency, usually the modulated carrier signal. These signals must be demodulated to recover the information.

Page 51: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Complex sinusoidal

-f0 0 f0-0.5

0

0.5

1

1.5

2

frequency

0-0.5

0

0.5

1

1.5

2

frequency

Page 52: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Implementation of Complex Signals

02j f nTe π−

x(n)

02j f nTe π−

y(n) x(n)

0cos 2 f nTπ⎛ ⎞⎜ ⎟⎝ ⎠

0sin 2 f nTπ⎛ ⎞⎜ ⎟⎝ ⎠

( )ry t

( )iy t

Page 53: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Sampling Complex Signal

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

-1.5

-1

-0.5

0

0.5

1

1.5

2

n=0

n=1

n=2

n=3

020 with 8

j f t sFe fπ−=

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

-1.5

-1

-0.5

0

0.5

1

1.5

2

n=1

n=2

n=3

020

7 with 8j f t sFe fπ−

=

Aliasing!

Page 54: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Discrete Fourier Transform (DFT)

• Suppose that we have a discrete-time signal, x(n), n=0,1,2,…,N-1. • We want to compute the Fourier Transform.

( )2 2j f j fnn

X e x n eπ π⎛ ⎞⎜ ⎟⎜ ⎟⎝ ⎠

∞−

=−∞= ∑

• There are two problems Ø The limits are doubly infinite Ø The frequency is continuous

Page 55: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Discrete Fourier Transform (DFT)

• Start with the FT ( )2 2j f j fnn

X e x n eπ π⎛ ⎞⎜ ⎟⎜ ⎟⎝ ⎠

∞−

=−∞= ∑

• Assume that the signal is 0 for n<0 and n>N-1. ( )

12 2

0

Nj f j fn

nX e x n eπ π⎛ ⎞

⎜ ⎟⎜ ⎟⎝ ⎠

−−

==∑

• Compute on a frequency grid

( )21

0

kj nN N

nX k x n e

π⎛ ⎞⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎝ ⎠⎛ ⎞

⎜ ⎟⎝ ⎠

−−

==∑% N- Point DFT

Page 56: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

DFT • Here is Matlab code for computing the DFT

N=input(' Enter N'); Xr=zeros(N,1); Xi=zeros(N,1); for k=1:N, f=(k-1)/N; for n=1:n, Xr(k)=Xr(k)+xr(n)*cos(2*pi*f*(n-1))+xi(n)*sin(2*pi*f*(n-1)); Xi(k)=Xi(k)+xi(n)*cos(2*pi*f*(n-1))-xr(n)*sin(2*pi*f*(n-1)); end end

Page 57: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

DFT • This takes 4N2 multiplies. The Cooley-Tukey (1965) showed how to compute the DFT with 2*N*log2(N). This made the DFT practical. • The DFT= the FT equation shown previously • The FFT (Fast Fourier Transform) is the Cooley-Tukey algorithm to compute the DFT

Page 58: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

DFT

x(n) X(k)

•  Note first half of X(k) corresponds to positive frequencies, second half negative. • k=0 f=0, k=1, f=1/N, k=2, f=2/N, etc.

Page 59: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

DFT

0 N-1-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

n

x(n)

0 0.5 10

0.5

1

1.5

f/Fs

|X(f)|

• Note periodic nature of the DFT. Also note the values of X(f) from 0.5 to 1 is the same as the values from -0.5 to 0.

Page 60: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

CW Radar Example Tx

Osc  f0

Rx

f0 fd1 fd2

Page 61: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

CW Radar Example

• Processing steps Ø Multiply by Ø LPF Ø ADC Ø MEM Ø FFT Ø Display

02j f te π

Page 62: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

CW Radar Example

-4000 -3000 -2000 -1000 0 1000 2000 3000 40000

0.025

0.05

0.075

0.1

0.125

0.15

0.2

Frequency in Hertz

Time i

n sec

onds

Page 63: Digital Signal Processing (DSP) Signal Analysis€¦ ·  · 2017-12-02Digital Signal Processing (DSP) Signal Analysis ... ak k ak bk π =−− = == == L L L ... ADC DSP DAC •The

Matlab Examples • We will take several examples and work them together with Matlab. • First lets look at sin 2 5tπ⎛ ⎞

⎜ ⎟⎜ ⎟⎝ ⎠

• We will look at various sampling frequencies and positive and negative frequencies • We will multiply by the cos(2*pi*5*t) and look at the spectrum of product • We will look at • Finally, we will look at the product of a complex sinusoid and another signal.

2 5j te π−