Anda di halaman 1dari 60

Discrete Time Periodic Signals

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

x[n] x[n N ]
for all n .
Meaning: a periodic signal keeps repeating itself forever!

x[n]

Example: a Sinusoid
Consider the Sinusoid:

x[n] 2 cos 0.2 n 0.9


It is periodic with period

N 10

since

x[n 10] 2 cos 0.2 (n 10) 0.9


2 cos 0.2 n 0.9 2 x[n]

for all n.

General Periodic Sinusoid


Consider a Sinusoid of the form:

x[n] A cos 2 n
N

with k, N integers.

It is periodic with period N since

x[n N ] A cos 2 (n N )
N

A cos 2 n k 2 x[n]
N

for all n.

Example of Periodic Sinusoid


Consider the sinusoid:

x[n] 5 cos 0.3 n 0.1

We can write it as:

x[n] 5 cos 2
n 0.1
20

It is periodic with period

N 20

since

x[n 20] 5 cos 0.3 (n 20) 0.1


5 cos 0.3 n 0.1 3 2 x[n]
for all n.

Periodic Complex Exponentials


Consider a Complex Exponential of the form:

x[n] Ae

2
j k
N

It is periodic with period N since

x[n N ] Ae

2
j k
( n N )
N

2
j k
N

Ae

jk 2

x[n]
for all n.

Example of a Periodic Complex Exponential


Consider the Complex Exponential:

x[n] (1 2 j )e j 0.1 n
We can write it as

x[n] (1 2 j )e

j 2 n
20

and it is periodic with period N = 20.

Reference Frames
Goal:
We want to write all discrete time periodic signals in terms
of a common set of reference signals.
It is like the problem of representing a vector
reference frame defined by
an origin 0

r
x

in a

reference vectors e1 , e2 ,...

e2
Reference
Frame

e1

Reference Frames in the Plane and in Space



For example in the plane we need two reference vectors e1 , e2

e2
Reference
Frame

e1


while in space we need three reference vectors e1 , e2 , e3
Reference
Frame

e3

e2

e1

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:

a2 e2

x a1e1 a2 e2

a1e1

0
Where

a1
a2

projection of
projection of

e1

along e2
along

The plane is a 2 dimensional space.

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:

a3e3

a2 e2
Where

x a1e1 a2 e2 a3e3

a1e1

a1
a2
a3

projection of
projection of
projection of

along e1

along e2

along e3

The space is a 3 dimensional space.

Example: where am I ?
r
x
N
E

e2
0

200m

e1 300m

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

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

x[n]

reference signals

Back to Periodic Signals


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

ek [n] e

j 2

k
n
N

k 0,..., N 1

as
N 1

x[n] ak ek [n]
k 0

A Simple Example
Take the periodic signal x[n] shown below:
2
1

Notice that it is periodic with period N=2.


Then the reference signals are

e0 [n] e
e1[n] e

0
j 2 n
2
1
j 2 n
2

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

x[n] 1.5e0 [n] 0.5e1[n]


1.5 1n 0.5 (1) n

for all n.

1n 1
(1) n

Another Simple Example


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

0.3

Then the reference signals are the same

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

e0 [n] e
e1[n] e

x[n] 0.5e0 [n] 0.8e1[n]


0.5 1n 0.8 (1) n

for all n.

Same reference signals, just different coefficients

0
j 2 n
2
1
j 2 n
2

1n 1
(1) n

Orthogonal Reference Signals


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

0 if m k
e [n]em [n]

n 0
N if m k
N 1

*
k

Since
N 1

N 1

*
e
k [n]em [n] e
n 0

n 0

mk
j 2
n
N

N 1

e
n 0

mk
j 2
N

1 e j 2 ( m k )
1 e

j 2

mk
N

by the geometric sum

apply it to the signal representation


N 1

N 1

x[n]e [n]

n 0

*
k

N 1

*
a
e
[
n
]
e

m m
k [ n]
n 0 m 0

x[ n ]

N 1

am

N 1

m 0

e [n]e
n 0

*
k

and we can compute the coefficients. Call


N 1

X [k ] Nak x[n]e
n 0

2
kn
N

[n] Nak

X [k ] Nak

then

k 0,..., N 1

Discrete Fourier Series


Given a periodic signal x[n] with period N we define the
Discrete Fourier Series (DFS) as
N 1

X [k ] x[n]e

2
kn
N

k 0,..., N 1

n 0

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

X [k ] DFS x[n]
for any

n0 N 1

n0

n n0

x[n]e

2
kn
N

k 0,..., N 1

Inverse Discrete Fourier Series

The inverse operation is called Inverse Discrete Fourier Series


(IDFS), defined as

1
x[n] IDFS X [k ]
N

N 1

X [k ]e
k 0

2
kn
N

Revisit the Simple Example


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

0
1

X [k ] x[n]e

2
nk
2

x[0] x[1](1) k 1 2 (1) k , k 0,1

n 0

Then

X [0] 3,

X [1] 1

Therefore we can write the sequence as


2
j
kn
1 1
2
x[n] IDFS X [k ] X [k ]e
2 k 0

1.5 0.5 (1) n

Example of Discrete Fourier Series


Consider this periodic signal

x[n]
1

10

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

X [k ] x[n]e
n 0

2
kn
10

e
n 0

2
kn
10

1 e

1 e
5

2
5k
10

2
j
k
10

if k 1, 2,...,9
if k 0

now plot the values


| X [k ] |

magnitude

0
0

X [k ]

10

10

phase (rad)

0
-2
0

Example of DFS
Compute the DFS of the periodic signal

x[n] 2 cos(0.5n)
Compute a few values of the sequence

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


and we see the period is N=2. Then
1

X [k ] x[n]e

2
kn
2

x[0] x[1] (1) k

n 0

which yields

X [0] X [1] 2

Signals of Finite Length


All signals we collect in experiments have finite length

x[n] x(nTs )

x(t )

1
Fs
Ts
TMAX

N TMAX FS

Example: we have 30ms of data sampled at 20kHz (ie 20,000


samples/sec). Then we have

N 30 10 3 20 103 600 data points

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 1

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):
N 1

X [k ] DFT x[n] x[n]e

2
kn
N

k 0,..., N 1

n0

And its inverse

1
x[n] IDFT X [k ]
N

N 1

X [k ]e
n0

2
kn
N

n 0,..., N 1

Signals of Finite Length


All signals we collect in experiments have finite length in time

x[n] x(nTs )

x(t )

1
Fs
Ts
TMAX

N TMAX FS

Example: we have 30ms of data sampled at 20kHz (ie 20,000


samples/sec). Then we have

N 30 10 3 20 103 600 data points

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 1

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):
N 1

X [k ] DFT x[n] x[n]e

2
kn
N

k 0,..., N 1

n0

and its inverse

1
x[n] IDFT X [k ]
N

N 1

X [k ]e
n0

2
kn
N

n 0,..., N 1

Example of Discrete Fourier Transform


Consider this signal

x[n]
1

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

X [k ] x[n]e
n 0

2
kn
10

e
n 0

2
kn
10

1 e

1 e
5

2
5k
10

2
j
k
10

if k 1, 2,...,9
if k 0

now plot the values


| X [k ] |

magnitude

0
0

X [k ]

10

10

phase (rad)

0
-2
0

DFT of a Complex Exponential


Consider a complex exponential of frequency

x[n] Ae

j 0 n

0 rad.

, n

We take a finite data length

x[n] Ae

j 0 n

0 n N 1

and its DFT


N 1

X [k ] DFT x[n] x[n]e

2
kn
N

, k 0,..., N 1

n 0

How does it look like?

Recall Magnitude, Frequency and Phase


Recall the following:
1. We assume the frequency to be in the interval

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


magnitude

phase

| A|

(rad )

A
0

(rad )

Compute the DFT


N 1

X [k ] DFT x[n] x[n]e

2
kn
N

n 0

N 1

Ae j0 n e

2
kn
N

n0

N 1

Ae

j k
0 n
N

n0

Notice that it has a general form:

X [k ] A WN k
0
N

where (use the geometric series)


N 1

WN ( ) e
n 0

j n

1 e j N

1 e j

, k 0,..., N 1

See its general form:

N 1

WN ( ) e j n
n 0

N
sin

e j ( N 1)/2

sin
2

since:
N 1

WN ( ) e j n
n 0

1 e j N

1 e j

e j N /2 e j N /2 e j N /2 e j N / 2

e j / 2 e j /2 e j /2 e j /2

N
sin

j N / 2
j N / 2
j N /2
e
e
e
2

j ( N 1)/2

e j / 2
e j / 2 e j / 2

sin
2

and plot the magnitude

WN ( )
12

10
8
6
4
2
0

-3

-2

-1

2
N

2
N

Example
Consider the sequence

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


In this case

0 0.3 , N 32

Then its DFT becomes

X [k ] W32 0.3 k 2 , k 0,...,31


32

Lets plot its magnitude:

... first plot this

W32 0.3
40
30

N 32

20
10
0
0

0 0.3

and then see the plot of its DFT

X [k ] WN 0.3 k 2 , k 0,..., N 1
N

35
30
25
20
15
10
5
0
0

10

The max corresponds to frequency

15

20

25

30

5 2 / 32 0.312 0.3

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.

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.

Same Example (more data points)


Consider the sequence

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


In this case

0 0.3 , N 256
>> n=0:255;
>>x=exp(j*0.3*pi*n);
>> X=fft(x);
>> plot(abs(X))
See the plot

and its magnitude plot

| X [k ] |
200
150
100
50
0
0

50

100

150

200

250

300

What does it mean?


A peak at index

k0

means that you have a frequency

0 ; k0 2 / N

| X [k ] |
200
150
100
50
0
0

50

k0 38

100

150

200

250

300

The max corresponds to frequency

38 2 / 256 0.2969 0.3

Example
You take the FFT of a signal and you get this magnitude:
| X [k ] |
1200
1000
800
600
400
200
0
0

k1 27

50

100

k2 81

There are two peaks corresponding


to two frequencies:

150

200

250

2
2
1 k1
27
0.2109
N
256
2
2
2 k 2
81
0.6328
N
256

300

DFT of a Sinusoid
Consider a sinusoid with frequency

0 rad.

x[n] A cos(0 n ), n
We take a finite data length

x[n] A cos(0 n ),

0 n N 1

and its DFT


N 1

X [k ] DFT x[n] x[n]e

2
kn
N

, k 0,..., N 1

n 0

How does it look like?

Sinusoid = sum of two exponentials


Recall that a sinusoid is the sum of two complex
exponentials

A j j 0 n A j j 0 n
x[n] e e
e e
2
2

magnitude

phase

A/ 2

A/ 2

(rad )

(rad )

Use of positive frequencies


Then the DFT of a sinusoid has two components

A j j0 n
A j j0 n

X [k ] DFT e e DFT
e e

2
2

but we have seen that the frequencies we compute


are positive. Therefore we replace the last exponential
as follows:

A j j (2 0 ) n
A j j0 n

X [k ] DFT e e DFT
e e

2
2

Represent a sinusoid with positive freq.


Then the DFT of a sinusoid has two components

A j j (2 0 ) n
A j j0 n

X [k ] DFT e e DFT
e e

2
2

magnitude

A/ 2
0

phase

A/ 2

2 0

2 0

(rad )

(rad )

Example
Consider the sequence

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


In this case

0 0.3 , N 32

Then its DFT becomes

X [k ] W32 0.3 W32 1.7 k 2 , k 0,...,31


32

2 0.3

Lets plot its magnitude:

... first plot this


1
W32 0.3 W32 1.7
2
20

N / 2 32 / 2

15

N / 2 32 / 2

10
5
0
0

0 0.3

0 1.7

and then see the plot of its DFT


1
X [k ] W32 0.3 W32 1.7
2

2
N

, k 0,..., N 1

20
15

This is NOT a frequency

10
5
0
0

10

15

The first max corresponds to frequency

20

25

30

5 2 / 32 0.3

35

Symmetry
If the signal x[n] is real, then its DFT has a symmetry:

X [k ] X [ N k ]*
In other words:

| X [k ] || X [ N k ] |
X [k ] X [ N k ]

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

Back to the Example:


20
15
10
5
0
0

10

15

20

25

30

35

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

Plot half the spectrum


20
15
10
5
0
0

10

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

15

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.

Same Example (more data points)


Consider the sequence

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


In this case

0 0.3 , N 256
>> n=0:255;
>>x=cos(0.3*pi*n);
>> X=fft(x);
>> plot(abs(X))
See the plot

and its magnitude plot

| X [k ] |
100
80
60
40
20
0
0

50

k0 38

100

The first max corresponds to frequency

150

200

250

N k0 218

0 38 2 / 256 0.3

Example
You take the FFT of a signal and you get this magnitude:
| X [k ] |
150

100

50

0
0

50

k1 27 k2 81

100

There are two peaks corresponding


to two frequencies:

150

200

250

2
2
1 k1
27
0.2109
N
256
2
2
2 k 2
81
0.6328
N
256

300

Anda mungkin juga menyukai