discrete time periodic signals a discrete time signal x[n] is periodic with period n if and only if...

60
Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if ] [ ] [ N n x n x for all n . Definition: N ] [ n x n Meaning : a periodic signal keeps repeating itself forever!

Upload: derek-small

Post on 22-Dec-2015

239 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Discrete Time Periodic Signals

A discrete time signal x[n] is periodic with period N if and only if

][][ Nnxnx for all n .

Definition:

N

][nx

n

Meaning: a periodic signal keeps repeating itself forever!

Page 2: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Example: a Sinusoid

[ ] 2cos 0.2 0.9x n n

Consider the Sinusoid:

It is periodic with period since 10N

][29.02.0cos2

9.0)10(2.0cos2]10[

nxn

nnx

for all n.

Page 3: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

General Periodic Sinusoid

n

N

kAnx 2cos][

Consider a Sinusoid of the form:

It is periodic with period N since

][22cos

)(2cos][

nxknN

kA

NnN

kANnx

for all n.

with k, N integers.

Page 4: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

1.03.0cos5][ nnx

Consider the sinusoid:

It is periodic with period since 20N

][231.03.0cos5

1.0)20(3.0cos5]20[

nxn

nnx

for all n.

We can write it as:

1.0

20

32cos5][ nnx

Example of Periodic Sinusoid

Page 5: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

nN

kj

Aenx

2

][

Consider a Complex Exponential of the form:

for all n.

It is periodic with period N since

Periodic Complex Exponentials

][

][

22

)(2

nxeAe

AeNnx

jkn

Nkj

NnN

kj

1

Page 6: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

njejnx 1.0)21(][

Consider the Complex Exponential:

We can write it as

Example of a Periodic Complex Exponential

nj

ejnx

20

12

)21(][

and it is periodic with period N = 20.

Page 7: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Goal:

We want to write all discrete time periodic signals in terms of a common set of “reference signals”.

Reference Frames

It is like the problem of representing a vector in a reference frame defined by

• an origin “0”

• reference vectors

x

,..., 21 ee

x

01e

2e

Reference Frame

Page 8: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Reference Frames in the Plane and in Space

For example in the plane we need two reference vectors

x

01e

2e

21,ee

Reference Frame

… while in space we need three reference vectors 321 ,, eee

0

1e

2e

Reference Frame

x

3e

Page 9: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

A Reference Frame in the Plane

If the reference vectors have unit length and they are perpendicular (orthogonal) to each other, then it is very simple:

2211 eaeax

0

11ea

22ea

Where projection of along

projection of along

1a

2a 2e1e

x

x

The plane is a 2 dimensional space.

Page 10: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

A Reference Frame in the Space

If the reference vectors have unit length and they are perpendicular (orthogonal) to each other, then it is very simple:

332211 eaeaeax

0

11ea

22ea

Where projection of along

projection of along

projection of along

1a

2a 2e1e

x

x

The “space” is a 3 dimensional space.

3a x

3e

33ea

Page 11: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Example: where am I ?

N

E0

1e

2e

x

m300

m200

Point “x” is 300m East and 200m North of point “0”.

Page 12: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Reference Frames for Signals

We want to expand a generic signal into the sum of reference signals.

The reference signals can be, for example, sinusoids or complex exponentials

n

][nx

reference signals

Page 13: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Back to Periodic Signals

A periodic signal x[n] with period N can be expanded in terms of N complex exponentials

1,...,0 ,][2

Nkenen

N

kj

k

as

1

0

][][N

kkk neanx

Page 14: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

A Simple Example

Take the periodic signal x[n] shown below:

n0

1

2

Notice that it is periodic with period N=2.

Then the reference signals are

nnj

nnj

ene

ene

)1(][

11][

2

12

1

2

02

0

We can easily verify that (try to believe!):

nn

nenenx

)1(5.015.1

][5.0][5.1][ 10

for all n.

Page 15: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Another Simple Example

Take another periodic signal x[n] with the same period (N=2):

n0

3.0

3.1

Then the reference signals are the same0

22

0

12

21

[ ] 1 1

[ ] ( 1)

j n n

j n n

e n e

e n e

We can easily verify that (again try to believe!):

nn

nenenx

)1(8.015.0

][8.0][5.0][ 10

for all n.

Same reference signals, just different coefficients

Page 16: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Orthogonal Reference Signals

Notice that, given any N, the reference signals are all orthogonal to each other, in the sense

kmN

kmnene

N

nmk if

if 0][][

1

0

*

1

0 2

)(221

0

21

0

*

1

1][][

N

n N

kmj

kmjn

N

kmjN

n

nN

kmjN

nmk

e

eeenene

Since

by the geometric sum

Page 17: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

… apply it to the signal representation …

k

N

m

N

nmkm

N

nk

nx

N

mmm

N

nk

Nanenea

neneanenx

1

0

1

0

*

1

0

*

][

1

0

1

0

*

][][

][][][][

and we can compute the coefficients. Call then kNakX ][

1,...,0 ,][][1

0

2

NkenxNakX

N

n

knNj

k

Page 18: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Discrete Fourier Series

1,...,0 ,][][1

0

2

NkenxkX

N

n

knNj

Given a periodic signal x[n] with period N we define the

Discrete Fourier Series (DFS) as

Since x[n] is periodic, we can sum over any period. The general definition of Discrete Fourier Series (DFS) is

1,...,0 ,][][][1 20

0

NkenxnxDFSkX

Nn

nn

knNj

for any0n

Page 19: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Inverse Discrete Fourier Series

1

0

2

][1

][][N

k

knNjekX

NkXIDFSnx

The inverse operation is called Inverse Discrete Fourier Series (IDFS), defined as

Page 20: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Revisit the Simple Example

Recall the periodic signal x[n] shown below, with period N=2:

n0

1

2

1,0,)1(21)1](1[]0[][][1

0

2

2

kxxenxkX kk

n

nkj

Then 1]1[,3]0[ XX

Therefore we can write the sequence as

n

k

knjekXkXIDFSnx

)1(5.05.1

][2

1][][

1

0

2

2

Page 21: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Example of Discrete Fourier Series

Consider this periodic signal

The period is N=10. We compute the Discrete Fourier Series

25

102 29 4

210 10

100 0

1 if 1, 2,...,9

[ ] [ ]15 if 0

j k

j kn j kn

j k

n n

ek

X k x n e ee

k

][nx

n010

1

Page 22: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

… now plot the values …

0 2 4 6 8 100

5magnitude

0 2 4 6 8 10-2

0

2phase (rad)

k

k

|][| kX

][kX

Page 23: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Example of DFS

Compute the DFS of the periodic signal

)5.0cos(2][ nnx

Compute a few values of the sequence

,...0]3[,2]2[,0]1[,2]0[ xxxx

and we see the period is N=2. Then

k

n

knjxxenxkX )1(]1[]0[][][

1

0

2

2

which yields

2]1[]0[ XX

Page 24: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Signals of Finite Length

All signals we collect in experiments have finite length

)(tx )(][ snTxnx

ss TF

1

MAXTMAX SN T F

Example: we have 30ms of data sampled at 20kHz (ie 20,000 samples/sec). Then we have

points data 60010201030 33 N

Page 25: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Series Expansion of Finite Data

We want to determine a series expansion of a data set of length N.

Very easy: just look at the data as one period of a periodic sequence with period N and use the DFS:

n

1N0

Page 26: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Discrete Fourier Transform (DFT)

Given a finite interval of a data set of length N, we define the Discrete Fourier Transform (DFT) with the same expression as the Discrete Fourier Series (DFS):

21

0

[ ] [ ] [ ] , 0,..., 1N j kn

N

n

X k DFT x n x n e k N

And its inverse

21

0

1[ ] [ ] [ ] , 0,..., 1

N j knN

n

x n IDFT X k X k e n NN

Page 27: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Signals of Finite Length

All signals we collect in experiments have finite length in time

)(tx )(][ snTxnx

ss TF

1

MAXTMAX SN T F

Example: we have 30ms of data sampled at 20kHz (ie 20,000 samples/sec). Then we have

points data 60010201030 33 N

Page 28: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Series Expansion of Finite Data

We want to determine a series expansion of a data set of length N.

Very easy: just look at the data as one period of a periodic sequence with period N and use the DFS:

n

1N0

Page 29: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Discrete Fourier Transform (DFT)

Given a finite of a data set of length N we define the Discrete Fourier Transform (DFT) with the same expression as the Discrete Fourier Series (DFS):

21

0

[ ] [ ] [ ] , 0,..., 1N j kn

N

n

X k DFT x n x n e k N

and its inverse

21

0

1[ ] [ ] [ ] , 0,..., 1

N j knN

n

x n IDFT X k X k e n NN

Page 30: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Example of Discrete Fourier Transform

Consider this signal

The length is N=10. We compute the Discrete Fourier Transform

25

102 29 4

210 10

100 0

1 if 1, 2,...,9

[ ] [ ]15 if 0

j k

j kn j kn

j k

n n

ek

X k x n e ee

k

][nx

n0

9

1

Page 31: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

… now plot the values …

0 2 4 6 8 100

5magnitude

0 2 4 6 8 10-2

0

2phase (rad)

k

k

|][| kX

][kX

Page 32: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

DFT of a Complex Exponential

Consider a complex exponential of frequency rad. 0

,][ 0njAenx n

We take a finite data length

,][ 0njAenx 0 1n N

… and its DFT

1,...,0,][][][1

0

2

NkenxnxDFTkX

N

n

knNj

How does it look like?

Page 33: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Recall Magnitude, Frequency and Phase

0

2. We represented it in terms of magnitude and phase:

( )rad0

0

magnitude

phase

|| A

A

Recall the following:

1. We assume the frequency to be in the interval

( )rad

Page 34: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Compute the DFT…

00

21

0

221 1

0 0

[ ] [ ] [ ]

, 0,..., 1

N j knN

n

N N j k nj knj n NN

n n

X k DFT x n x n e

Ae e Ae k N

Notice that it has a general form:

0

2[ ] NX k A W k

N

1

0

1( )

1

j NNj n

N jn

eW e

e

where (use the geometric series)

Page 35: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

See its general form:

1( 1)/2

0

sin2

( )sin

2

Nj n j N

Nn

N

W e e

Page 36: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

… since:

1

0

/2 /2 /2 /2

/2 /2 /2 /2

/2 /2 /2( 1)/2

/2 /2 /2

1( )

1

sin2

sin

2

j NNj n

N jn

j N j N j N j N

j j j j

j N j N j Nj N

j j j

eW e

e

e e e e

e e e eN

e e ee

e e e

Page 37: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

… and plot the magnitude

-3 -2 -1 0 1 2 30

2

4

6

8

10

12

( )NW

N

2

N

2

N

Page 38: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Example

Consider the sequence

0.3[ ] , 0,...,31j nx n e n

In this case 32,3.00 NThen its DFT becomes

23232

[ ] 0.3 , 0,...,31k

X k W k

Let’s plot its magnitude:

Page 39: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

... first plot this …

0 1 2 3 4 5 60

10

20

30

40

3.032 W

2

32N

3.00

Page 40: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

… and then see the plot of its DFT

0 5 10 15 20 25 300

5

10

15

20

25

30

35

2[ ] 0.3 , 0,..., 1N kN

X k W k N

kThe max corresponds to frequency 3.0312.032/25

Page 41: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Same Example in Matlab

Generate the data:

>> n=0:31;

>>x=exp(j*0.3*pi*n);

Compute the DFT (use the “Fast” Fourier Transform, FFT):

>> X=fft(x);

Plot its magnitude:

>> plot(abs(X))

… and obtain the plot we saw in the previous slide.

Page 42: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Same Example in Matlab

Generate the data:

>> n=0:31;

>>x=exp(j*0.3*pi*n);

Compute the DFT (use the “Fast” Fourier Transform, FFT):

>> X=fft(x);

Plot its magnitude:

>> plot(abs(X))

… and obtain the plot we saw in the previous slide.

Page 43: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Same Example (more data points)

Consider the sequence

0.3[ ] , 0,..., 255j nx n e n

In this case 0 0.3 , 256N >> n=0:255;

>>x=exp(j*0.3*pi*n);

>> X=fft(x);

>> plot(abs(X))

See the plot …

Page 44: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

… and its magnitude plot

0 50 100 150 200 250 3000

50

100

150

200

k

| [ ] |X k

Page 45: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

What does it mean?

The max corresponds to frequency

38 2 / 256 0.2969 0.3

A peak at index means that you have a frequency 0k

0 50 100 150 200 250 3000

50

100

150

200

k

| [ ] |X k

0 38k

0 0 2 /k N

Page 46: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Example

You take the FFT of a signal and you get this magnitude:

0 50 100 150 200 250 3000

200

400

600

800

1000

1200

|][| kX

k271 k 2 81k

There are two peaks corresponding

to two frequencies:

6328.0256

281

2

2109.0256

227

2

22

11

Nk

Nk

Page 47: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

DFT of a Sinusoid

Consider a sinusoid with frequency rad. 0

0[ ] cos( ),x n A n n

We take a finite data length

0 1n N

… and its DFT

1,...,0,][][][1

0

2

NkenxnxDFTkX

N

n

knNj

How does it look like?

0[ ] cos( ),x n A n

Page 48: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Sinusoid = sum of two exponentials

Recall that a sinusoid is the sum of two complex exponentials

njjnjj eeA

eeA

nx 00

22][

( )rad0

0

magnitude

phase

/ 2A

( )rad

0

0

/ 2A

Page 49: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Use of positive frequencies

0 0[ ]2 2

j n j nj jA AX k DFT e e DFT e e

Then the DFT of a sinusoid has two components

… but we have seen that the frequencies we compute are positive. Therefore we replace the last exponential as follows:

0 0(2 )[ ]2 2

j n j nj jA AX k DFT e e DFT e e

Page 50: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Represent a sinusoid with positive freq.

Then the DFT of a sinusoid has two components

( )rad0

0

magnitude

phase

/ 2A

( )rad2

202

/ 2A

02

0 0(2 )[ ]2 2

j n j nj jA AX k DFT e e DFT e e

Page 51: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Example

Consider the sequence

[ ] 2cos(0.3 ), 0,...,31x n n n

In this case 32,3.00 NThen its DFT becomes

232 3232

[ ] 0.3 1.7 , 0,...,31k

X k W W k

Let’s plot its magnitude:

3.02

Page 52: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

... first plot this …

0 1 2 3 4 5 60

5

10

15

20

32 32

10.3 1.7

2W W

/ 2 32 / 2N

3.00 0 1.7

/ 2 32 / 2N

2

Page 53: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

… and then see the plot of its DFT

kThe first max corresponds to frequency 3.032/25

32 322

1[ ] 0.3 1.7 , 0,..., 1

2 kN

X k W W k N

0 5 10 15 20 25 30 350

5

10

15

20

This is NOT a frequency

Page 54: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Symmetry

If the signal is real, then its DFT has a symmetry: ][nx

*][][ kNXkX

In other words:

][][

|][||][|

kNXkX

kNXkX

Then the second half of the spectrum is redundant (it does not contain new information)

Page 55: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Back to the Example:

0 5 10 15 20 25 30 350

5

10

15

20

If the signal is real we just need the first half of the spectrum, since the second half is redundant.

Page 56: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Plot half the spectrum

If the signal is real we just need the first half of the spectrum, since the second half is redundant.

0 5 10 150

5

10

15

20

Page 57: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Same Example in Matlab

Generate the data:

>> n=0:31;

>>x=cos(0.3*pi*n);

Compute the DFT (use the “Fast” Fourier Transform, FFT):

>> X=fft(x);

Plot its magnitude:

>> plot(abs(X))

… and obtain the plot we saw in the previous slide.

Page 58: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Same Example (more data points)

Consider the sequence

[ ] cos(0.3 ), 0,..., 255x n n n

In this case 0 0.3 , 256N >> n=0:255;

>>x=cos(0.3*pi*n);

>> X=fft(x);

>> plot(abs(X))

See the plot …

Page 59: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

… and its magnitude plot

k

| [ ] |X k

0 50 100 150 200 2500

20

40

60

80

100

0 38k 0 218N k

The first max corresponds to frequency 0 38 2 / 256 0.3

Page 60: Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps

Example

You take the FFT of a signal and you get this magnitude:|][| kX

k

There are two peaks corresponding

to two frequencies:

6328.0256

281

2

2109.0256

227

2

22

11

Nk

Nk

0 50 100 150 200 250 3000

50

100

150

271 k 2 81k