You are on page 1of 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!
Example: a Sinusoid
( )
[ ] 2cos 0.2 0.9 x n n t t = +
Consider the Sinusoid:
It is periodic with period since 10 = N
( )
( ) ] [ 2 9 . 0 2 . 0 cos 2
9 . 0 ) 10 ( 2 . 0 cos 2 ] 10 [
n x n
n n x
= + + =
+ + = +
t t t
t t
for all n.
General Periodic Sinusoid
|
.
|

\
|
+ = o t n
N
k
A n x 2 cos ] [
Consider a Sinusoid of the form:
It is periodic with period N since
] [ 2 2 cos
) ( 2 cos ] [
n x k n
N
k
A
N n
N
k
A N n x
=
|
.
|

\
|
+ + =
|
.
|

\
|
+ + = +
t o t
o t
for all n.
with k, N integers.
( ) t t 1 . 0 3 . 0 cos 5 ] [ = n n x
Consider the sinusoid:
It is periodic with period since 20 = N
( )
( ) ] [ 2 3 1 . 0 3 . 0 cos 5
1 . 0 ) 20 ( 3 . 0 cos 5 ] 20 [
n x n
n n x
= + =
+ = +
t t t
t t
for all n.
We can write it as:
|
.
|

\
|
= t t 1 . 0
20
3
2 cos 5 ] [ n n x
Example of Periodic Sinusoid
n
N
k j
Ae n x
|
.
|

\
|
=
t 2
] [
Consider a Complex Exponential of the form:
for all n.
It is periodic with period N since
Periodic Complex Exponentials
] [
] [
2
2
) (
2
n x e Ae
Ae N n x
jk
n
N
k j
N n
N
k j
= =
= +
|
.
|

\
|
+
|
.
|

\
|
t
t
t
1 =
n j
e j n x
t 1 . 0
) 2 1 ( ] [ + =
Consider the Complex Exponential:
We can write it as
Example of a Periodic Complex Exponential
n j
e j n x
|
.
|

\
|
+ =
20
1
2
) 2 1 ( ] [
t
and it is periodic with period N = 20.
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
,... ,
2 1
e e

x

0
1
e

2
e

Reference
Frame
Reference Frames in the Plane and in Space
For example in the plane we need two reference vectors
x

0
1
e

2
e

2 1
, e e

Reference
Frame
while in space we need three reference vectors
3 2 1
, , e e e

0
1
e

2
e

Reference
Frame
x

3
e

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:
2 2 1 1
e a e a x

+ =
0
1 1
e a

2 2
e a

Where projection of along
projection of along
1
a
2
a
2
e

1
e

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:
3 3 2 2 1 1
e a e a e a x

+ + =
0
1 1
e a

2 2
e a

Where projection of along
projection of along
projection of along
1
a
2
a
2
e

1
e

The space is a 3 dimensional space.


3
a
x

3
e

3 3
e a

Example: where am I ?
N
E
0
1
e

2
e

x
m 300
m 200
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
n
] [n x
=

reference signals
Back to Periodic Signals
A periodic signal x[n] with period N can be expanded in terms of N
complex exponentials
1 ,..., 0 , ] [
2
= = N k e n e
n
N
k
j
k
t
as

=
=
1
0
] [ ] [
N
k
k k
n e a n x
A Simple Example
Take the periodic signal x[n] shown below:
n
0
1
2
Notice that it is periodic with period N=2.
Then the reference signals are
n
n j
n
n j
e n e
e n e
) 1 ( ] [
1 1 ] [
2
1
2
1
2
0
2
0
= =
= = =
t
t
We can easily verify that (try to believe!):
n n
n e n e n x
) 1 ( 5 . 0 1 5 . 1
] [ 5 . 0 ] [ 5 . 1 ] [
1 0
=
+ =
for all n.
Another Simple Example
Take another periodic signal x[n] with the same period (N=2):
n
0
3 . 0
3 . 1
Then the reference signals are the same
0
2
2
0
1
2
2
1
[ ] 1 1
[ ] ( 1)
j n
n
j n
n
e n e
e n e
t
t
= = =
= =
We can easily verify that (again try to believe!):
n n
n e n e n x
) 1 ( 8 . 0 1 5 . 0
] [ 8 . 0 ] [ 5 . 0 ] [
1 0
+ =
+ =
for all n.
Same reference signals, just different coefficients
Orthogonal Reference Signals
Notice that, given any N, the reference signals are all orthogonal
to each other, in the sense

=
=
=

=
k m N
k m
n e n e
N
n
m k
if
if 0
] [ ] [
1
0
*


=

=
|
|
.
|

\
|
= =
1
0
2
) ( 2
2
1
0
2
1
0
*
1
1
] [ ] [
N
n
N
k m
j
k m j
n
N
k m
j
N
n
n
N
k m
j
N
n
m k
e
e
e e n e n e
t
t
t t
Since
by the geometric sum
apply it to the signal representation
k
N
m
N
n
m k m
N
n
k
n x
N
m
m m
N
n
k
Na n e n e a
n e n e a n e n x
= |
.
|

\
|
=
|
.
|

\
|
=

=
1
0
1
0
*
1
0
*
] [
1
0
1
0
*
] [ ] [
] [ ] [ ] [ ] [

and we can compute the coefficients. Call then
k
Na k X = ] [
1 ,..., 0 , ] [ ] [
1
0
2
= = =

N k e n x Na k X
N
n
kn
N
j
k
t
Discrete Fourier Series
1 ,..., 0 , ] [ ] [
1
0
2
= =

N k e n x k X
N
n
kn
N
j
t
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
2
0
0
= = =

+
=

N k e n x n x DFS k X
N n
n n
kn
N
j
t
for any
0
n
Inverse Discrete Fourier Series
{ }

=
= =
1
0
2
] [
1
] [ ] [
N
k
kn
N
j
e k X
N
k X IDFS n x
t
The inverse operation is called Inverse Discrete Fourier Series
(IDFS), defined as
Revisit the Simple Example
Recall the periodic signal x[n] shown below, with period N=2:
n
0
1
2
1 , 0 , ) 1 ( 2 1 ) 1 ]( 1 [ ] 0 [ ] [ ] [
1
0
2
2
= + = + = =

k x x e n x k X
k k
n
nk j
t
Then 1 ] 1 [ , 3 ] 0 [ = = X X
Therefore we can write the sequence as
{ }
n
k
kn j
e k X k X IDFS n x
) 1 ( 5 . 0 5 . 1
] [
2
1
] [ ] [
1
0
2
2
=
= =

=
t
Example of Discrete Fourier Series
Consider this periodic signal
The period is N=10. We compute the Discrete Fourier Series
2
5
10
2 2
9 4
2 10 10
10
0 0
1
if 1, 2,..., 9
[ ] [ ]
1
5 if 0
j k
j kn j kn
j k
n n
e
k
X k x n e e
e
k
t
t t
t

= =

= = =


] [n x
n
0
10
1
now plot the values
0 2 4 6 8 10
0
5
magnitude
0 2 4 6 8 10
-2
0
2
phase (rad)
k
k
| ] [ | k X
] [k X Z
Example of DFS
Compute the DFS of the periodic signal
) 5 . 0 cos( 2 ] [ n n x t =
Compute a few values of the sequence
,... 0 ] 3 [ , 2 ] 2 [ , 0 ] 1 [ , 2 ] 0 [ = = = = x x x x
and we see the period is N=2. Then
k
n
kn j
x x e n x k X ) 1 ( ] 1 [ ] 0 [ ] [ ] [
1
0
2
2
+ = =

t
which yields
2 ] 1 [ ] 0 [ = = X X
Signals of Finite Length
All signals we collect in experiments have finite length
) (t x
) ( ] [
s
nT x n x =
s
s
T
F
1
=
MAX
T
MAX S
N T F =
Example: we have 30ms of data sampled at 20kHz (ie 20,000
samples/sec). Then we have
( ) ( ) points data 600 10 20 10 30
3 3
= =

N
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 N 0
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):
{ }
2
1
0
[ ] [ ] [ ] , 0,..., 1
N
j kn
N
n
X k DFT x n x n e k N
t


=
= = =

And its inverse


{ }
2
1
0
1
[ ] [ ] [ ] , 0,..., 1
N
j kn
N
n
x n IDFT X k X k e n N
N
t

=
= = =

Signals of Finite Length


All signals we collect in experiments have finite length in time
) (t x
) ( ] [
s
nT x n x =
s
s
T
F
1
=
MAX
T
MAX S
N T F =
Example: we have 30ms of data sampled at 20kHz (ie 20,000
samples/sec). Then we have
( ) ( ) points data 600 10 20 10 30
3 3
= =

N
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 N 0
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):
{ }
2
1
0
[ ] [ ] [ ] , 0,..., 1
N
j kn
N
n
X k DFT x n x n e k N
t


=
= = =

and its inverse


{ }
2
1
0
1
[ ] [ ] [ ] , 0,..., 1
N
j kn
N
n
x n IDFT X k X k e n N
N
t

=
= = =

Example of Discrete Fourier Transform


Consider this signal
The length is N=10. We compute the Discrete Fourier Transform
2
5
10
2 2
9 4
2 10 10
10
0 0
1
if 1, 2,..., 9
[ ] [ ]
1
5 if 0
j k
j kn j kn
j k
n n
e
k
X k x n e e
e
k
t
t t
t

= =

= = =


] [n x
n
0
9
1
now plot the values
0 2 4 6 8 10
0
5
magnitude
0 2 4 6 8 10
-2
0
2
phase (rad)
k
k
| ] [ | k X
] [k X Z
DFT of a Complex Exponential
Consider a complex exponential of frequency rad.
0
e
, ] [
0
n j
Ae n x
e
=
+ < < n
We take a finite data length
, ] [
0
n j
Ae n x
e
= 0 1 n N s s
and its DFT
{ } 1 ,..., 0 , ] [ ] [ ] [
1
0
2
= = =

N k e n x n x DFT k X
N
n
kn
N
j
t
How does it look like?
Recall Magnitude, Frequency and Phase
0
t e t < s +
2. We represented it in terms of magnitude and phase:
( ) rad e
0
e
0
e
magnitude
phase
| | A
A Z
Recall the following:
1. We assume the frequency to be in the interval
t
t t
t
( ) rad e
Compute the DFT
{ }
0
0
2
1
0
2
2
1 1
0 0
[ ] [ ] [ ]
, 0,..., 1
N
j kn
N
n
N N
j k n
j kn
j n N
N
n n
X k DFT x n x n e
Ae e Ae k N
t
t
t
e
e


=
| |

|
\ .
= =
= =
= = =


Notice that it has a general form:
0
2
[ ]
N
X k A W k
N
t
e
| |
=
|
\ .
1
0
1
( )
1
j N
N
j n
N
j
n
e
W e
e
e
e
e
e

= =

where (use the geometric series)


See its general form:
1
( 1)/ 2
0
sin
2
( )
sin
2
N
j n j N
N
n
N
W e e
e e
e
e
e


=
| |
|
\ .
= =
| |
|
\ .

since:
1
0
/ 2 / 2 / 2 / 2
/ 2 / 2 / 2 / 2
/ 2 / 2 / 2
( 1)/ 2
/ 2 / 2 / 2
1
( )
1

sin
2

sin
2
j N
N
j n
N
j
n
j N j N j N j N
j j j j
j N j N j N
j N
j j j
e
W e
e
e e e e
e e e e
N
e e e
e
e e e
e
e
e
e e e e
e e e e
e e e
e
e e e
e
e
e

= =

| |
|
| || |
\ .
= =
| |
| |
\ .\ .
|
\ .

and plot the magnitude


-3 -2 -1 0 1 2 3
0
2
4
6
8
10
12
( )
N
W e
e
t t
N
2
N
t
2
N
t

Example
Consider the sequence
0.3
[ ] , 0,..., 31
j n
x n e n
t
= =
In this case 32 , 3 . 0
0
= = N t e
Then its DFT becomes
( ) 2
32
32
[ ] 0.3 , 0,..., 31
k
X k W k
t
e
e t
=
= =
Lets plot its magnitude:
... first plot this
0 1 2 3 4 5 6
0
10
20
30
40
( ) t e 3 . 0
32
W
e
2t
32 = N
t e 3 . 0
0
=
and then see the plot of its DFT
0 5 10 15 20 25 30
0
5
10
15
20
25
30
35
( ) 2
[ ] 0.3 , 0,..., 1
N
k
N
X k W k N
t
e
e t
=
= =
k
The max corresponds to frequency
t t t e 3 . 0 312 . 0 32 / 2 5 ~ = =
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
0.3
[ ] , 0,..., 255
j n
x n e n
t
= =
In this case
0
0.3 , 256 N e t = =
>> n=0:255;
>>x=exp(j*0.3*pi*n);
>> X=fft(x);
>> plot(abs(X))
See the plot
and its magnitude plot
0 50 100 150 200 250 300
0
50
100
150
200
k
| [ ]| X k
What does it mean?
The max corresponds to frequency
38 2 / 256 0.2969 0.3 e t t t = = ~
A peak at index means that you have a frequency
0
k
0 50 100 150 200 250 300
0
50
100
150
200
k
| [ ]| X k
0
38 k =
( )
0 0
2 / k N e t
Example
You take the FFT of a signal and you get this magnitude:
0 50 100 150 200 250 300
0
200
400
600
800
1000
1200
| ] [ | k X
k
27
1
= k
2
81 k =
There are two peaks corresponding
to two frequencies:
t
t t
e
t
t t
e
6328 . 0
256
2
81
2
2109 . 0
256
2
27
2
2 2
1 1
= = =
= = =
N
k
N
k
DFT of a Sinusoid
Consider a sinusoid with frequency rad.
0
e
0
[ ] cos( ), x n A n e o = + + < < n
We take a finite data length
0 1 n N s s
and its DFT
{ } 1 ,..., 0 , ] [ ] [ ] [
1
0
2
= = =

N k e n x n x DFT k X
N
n
kn
N
j
t
How does it look like?
0
[ ] cos( ), x n A n e o = +
Sinusoid = sum of two exponentials
Recall that a sinusoid is the sum of two complex
exponentials
n j j n j j
e e
A
e e
A
n x
0 0
2 2
] [
e o e o
+ =
( ) rad e
0
e
0
e
magnitude
phase
/ 2 A
o
t
t t
t
( ) rad e
0
e
0
e
/ 2 A
o
Use of positive frequencies
0 0
[ ]
2 2
j n j n j j
A A
X k DFT e e DFT e e
e e o o

= +
` `
) )
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 n j j
A A
X k DFT e e DFT e e
e t e o o

= +
` `
) )
Represent a sinusoid with positive freq.
Then the DFT of a sinusoid has two components
( ) rad e
0
e
0
e
magnitude
phase
/ 2 A
o
t
t
( ) rad e
2t
2t
0
2t e
/ 2 A
0
2t e
o
0 0
(2 )
[ ]
2 2
j n j n j j
A A
X k DFT e e DFT e e
e t e o o

= +
` `
) )
Example
Consider the sequence
[ ] 2cos(0.3 ), 0,..., 31 x n n n t = =
In this case 32 , 3 . 0
0
= = N t e
Then its DFT becomes
( ) ( ) 2
32 32
32
[ ] 0.3 1.7 , 0,...,31
k
X k W W k
t
e
e t e t
=
= + =
Lets plot its magnitude:
t t 3 . 0 2
... first plot this
0 1 2 3 4 5 6
0
5
10
15
20
( ) ( )
32 32
1
0.3 1.7
2
W W e t e t +
/ 2 32/ 2 N =
t e 3 . 0
0
=
0
1.7 e t =
/ 2 32/ 2 N =
e
2t
and then see the plot of its DFT
k
The first max corresponds to frequency
t t e 3 . 0 32 / 2 5 ~ =
( ) ( )
32 32
2
1
[ ] 0.3 1.7 , 0,..., 1
2
k
N
X k W W k N
t
e
e t e t
=
= + =
0 5 10 15 20 25 30 35
0
5
10
15
20
This is NOT a frequency
Symmetry
If the signal is real, then its DFT has a symmetry:
] [n x
*
] [ ] [ k N X k X =
In other words:
] [ ] [
| ] [ | | ] [ |
k N X k X
k N X k X
Z = Z
=
Then the second half of the spectrum is redundant (it does not
contain new information)
Back to the Example:
0 5 10 15 20 25 30 35
0
5
10
15
20
If the signal is real we just need the first half of the spectrum,
since the second half is redundant.
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 15
0
5
10
15
20
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
[ ] cos(0.3 ), 0,..., 255 x n n n t = =
In this case
0
0.3 , 256 N e t = =
>> n=0:255;
>>x=cos(0.3*pi*n);
>> X=fft(x);
>> plot(abs(X))
See the plot
and its magnitude plot
k
| [ ]| X k
0 50 100 150 200 250
0
20
40
60
80
100
0
38 k =
0
218 N k =
The first max corresponds to frequency
0
38 2 / 256 0.3 e t t = ~
Example
You take the FFT of a signal and you get this magnitude:
| ] [ | k X
k
There are two peaks corresponding
to two frequencies:
t
t t
e
t
t t
e
6328 . 0
256
2
81
2
2109 . 0
256
2
27
2
2 2
1 1
= = =
= = =
N
k
N
k
0 50 100 150 200 250 300
0
50
100
150
27
1
= k
2
81 k =

You might also like