Problem Set 6: Discrete-Time Fourier Series and Transform and Discrete Fourier Transform Using Matlab

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Problem set 6: Discrete-time Fourier series and

transform and Discrete Fourier Transform using Matlab


Signals and Systems 4CB00, TU/e
2022-2023

Learning outcomes
 Compute the Discrete-Time Fourier series either by solving a linear system or by using the provided
formulas (PS6: 1.1).
 Compute convolution with the convolution property of the Discrete-time Fourier transform.
Remarks
The material pertaining to this problem set will not appear in the exam.
• Problem 1.1 challenges you to use Matlab to compute the discrete-time Fourier series. By solving
this exercise you have also an alternative way (rather than using the fft.m function) of computing the
Discrete Fourier Transform (DFT), which we shall learn later: solve the linear system mentioned there
and then make X[k] = N ak . However, it is much less efficient. Still, it will hopefully give you some
reassurance that you could solve your project without the ’magical’ function fft.m.
• Problem 1.2 asks you to compute samples of the discrete-time Fourier transform. As we shall see later,
this is actually nothing more that the Discrete Fourier transform (DFT). By solving this you become
more acquainted with the fft.m function which is key for the project.

1 Discrete-time Fourier series

1.1 The Fourier coefficients of a periodic signal can be obtained by two methods: (i) solving a linear
system of equations;
  
1 1 1 1 ... 1
 
x[0] 2π 2π 2π 2π
a0
 x[1]    1 ej N ej N 2 ej N 3 ... ej N (N − 1) 
 a1 
2π 2π 2π 2π
ej N 2 ej 4 4 ej N 6 ej N 2(N −1)
   
x[2]   1 ... a2
  

= 2π 2π 2π 2π
   
x[3]   1 j
e N 3 j
e N 6 j
e N 9
... e N 3(N −1)
j a3
  

..   . .. .. .. .. .. ..
   
  ..

. .
 
. . . . .
  

x[N − 1] 2π 2π 2π 2π
1 ej N (N −1) ej N 2(N −1) ej N 3(N −2) . . . ej(N −1)(N −1) N aN −1

(ii) computing them by the analysis formula:


N −1
1 X 2π
ak = x[n]e−j N kn ,
N n=0

To compute the coefficients ak , k ∈ {0, 1, . . . , N − 1} with method (ii) we can use the following instructions
given the x[n], n ∈ {0, 1, . . . , N − 1} (for this example x[n] is a periodic signal with x[0] = 1, . . . , x[4] = 5
and period 5)

1
x = [1 2 3 4 5];
N = length(x);
X = fft(x);
a = X/N;

Although this instruction ’fft.m’ will be used later to compute the DFT it can indeed be used to compute
the Fourier series coefficients as well. In fact, typing ’help fft.m’ in the Matlab command line we can see
that the instruction fft.m (with appropriate indexing) computes
N −1

X
X[k] = x[n]e−j N kn
n=0

so that
X[k]
, k ∈ {0, 1, . . . , N − 1}
ak =
N
This exercise asks you to compute these very same coefficients with method (i) which amounts to building
the N × N matrix shown above and then solving a linear system; to solve a linear system Ay = b use the
matlab instruction code.

y = A\b

2 Discrete-time Fourier transform

2.1 An analytical expression for the discrete-time Fourier transform can only be obtained in very special
cases. We have seen for instance two such cases: the signals

1, |n| ≤ N1
x[n] = , x[n] = an u[n], |a| < 1
0, |n| > N1

have discrete–time Fourier transforms


1

jω sin(ω N1 + ) 1
2
, X ejω =
 
X e =
sin( ω2 ) 1 − ae−jω

respectively. For more general signals one could try to plot using symbolic toolboxes
N2
X
X ejω = x[n]e−jωn


n=−N1

for a signal identically zero outside of the interval {−N1 , . . . , N2 } but this is hard when N1 and N2 are large
(think of a voice signal with more than 10000 samples per second). In any case, for plotting purposes we
would have to consider then a grid of values ω = k∆ for some typically small ∆. If we make

∆=
N
for a given large N and assume that N1 = 0 and N2 = L − 1 for L ≤ N we would like to compute
L−1

X
X ejω x[n]e−j N kn

ω= 2π
=
N k
n=0

2
Equivalently, if we let the following auxiliary signal (obtained by padding x with zeros) by
(
x[k] if k ∈ {0, . . . , L − 1}
x̃[k] =
0 if k ∈ {L, L + 1, . . . , N − 1}

we would like to compute


N −1

X

x̃[n]e−j N kn

X e |ω= 2π
N k
=
n=0

Note that this is exactly what the instruction fft.m computes. Given a signal x[k] with bounded support in
the interval {−N1 , . . . , N2 }, we can shift it to belong to {0, . . . , N − 1}, with L = N2 + N1 + 1 obtaining
x̄[k] = x[k − N1 ]. The discrete–time Fourier transforms of x[k] and x̄[k], denoted by X(ejω ) and X̄(ejω ),
respectively, are related by X̄(ejω ) = X(ejω )e−jωN1 , or equivalently X(ejω ) = X̄(ejω )ejωN1 . 
Applying this method and using the instruction fft.m, compute N = 100 samples X ejω ω= 2π k , k ∈
N
{0, . . . , N − 1} of the discrete–time Fourier transform of

1, |n| ≤ N1
x[n] = ,
0, |n| > N1

when L = 2N1 + 1, N1 = 10, and confirm that they are given by

sin(ω(N1 + 12 ))
X ejω |ω= 2π

N k
= |ω= 2π
N k
.
sin( ω2 )

References
[1] Alan V. Oppenheim, Alan S. Willsky, S. Hamid Nawab, Signals & Systems. Addison Wesley, Mas-
sachusetts, 2nd edition, 1996.

You might also like