Experiment 06 Lab Manual
American International University- Bangladesh
Department of Electrical and Electronic Engineering
EEE3211: Digital Signal Processing Laboratory
Title: Discrete Fourier Series and Discrete Fourier Transform.
Introduction:
A Fourier series is a representation of a function in terms of a summation of an infinite
number of harmonically-related sinusoids with different amplitudes and phases. The
amplitude and phase of a sinusoid can be combined into a single complex number, called a
Fourier coefficient. When the function being represented, whether finite-length or periodic,
is discrete, the Fourier series coefficients are periodic, and can therefore be described by
a finite set of complex numbers. That set is called a discrete Fourier transform (DFT).
The primary objective of this simulation experiment is to-
1. Have an in-depth understanding of DFT using simulated environment.
2. Representing DFS as a suitable tool for manipulating discrete-time signals.
Theory and Methodology:
If a discrete signal x(n) is periodic with a period of N. It means the signal satisfies the
following condition x(n) = x(n + kN) , where k is integer and N is the fundamental period of
the sequence. Then this signal can be expressed
1
as
𝑁−1 2𝜋 𝑘𝑛
j
x(n) = 𝑁 ∑𝑘=0 X(𝑘)𝑒 𝑁 ............................. (A)
where n = 0 , ± 1 , ± 2 ,......... and X ( k ), k = 0 , ± 1 , ± 2 ,...........are called the discrete Fourier
series coefficients, which is given by
2𝜋 𝑘𝑛
𝑁−1 𝑥(𝑛)𝑒 −j 𝑁 …. … …(B)
X(k) = ∑𝑛=0
where k = 0, ± 1 , ± 2 ,......... . The discrete Fourier series coefficients X(k) is itself a
complex-valued periodic sequence with fundamental period of N. Using WN=exp(-2𝜋/𝑁), we
express equation (A) & (B) as-
𝑁−1 𝑥(𝑛)W nk ..................... (C)
X(k) = ∑𝑛=0 N
x(n) = 1 ∑𝑁−1 X(𝑘)WN -nk...................... (D)
𝑁 𝑘=0
Discrete Fourier Transform (DFT)
To compute the Fourier transform numerically on a computer, discretization plus numerical
integration are required. This is an approximation of the true (i.e., mathematical),
analytically-defined FT in a synthetic (digital) environment, and is called Discrete Fourier
Transformation (DFT). The DFT of a continuous time signal sampled over the period of T,
with a sampling rate of Δt can be given as
S(m∆𝑓) = 𝑇 ∑𝑁−1 𝑠(𝑛∆𝑡)𝑒−j2𝜋𝑚∆𝑓𝑛∆𝑡
𝑁 𝑛=0
where Δf=1/T, and, is valid at frequencies up to fmax = 1/(2Δt).
The Discrete Fourier Series (DFS) is practically equivalent to the Discrete Fourier
Transform (DFT) when 0≤n≤N-1. [The students are asked to check the text book for
proof] Therefore, the implementation of DFT should be similar to that of DFS.
© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 1
Pre-Lab Homework:
Study the formulae of Discrete Fourier Series (DFS) and Discrete Fourier Transform from
Theory and methodology section.
Apparatus:
1. Computer (Desktop/Laptop)
2. MATLAB (at least version 6)
Precautions:
Make sure that all the m-files are saved in the current directory of MATLAB. Otherwise, the
m-files will not be found and executed when they are called from the command window
Experimental Procedure:
Example 1: Find the DFT of a periodic discrete signal defined by
x(n)={ ……. 0,1,2,3,0,1,2,3,0,1,2,3 ...................... }
↑
Also find one period of the signal from the DFS coefficients implementing Inverse Discrete
Fourier Transform. [For the given signal, the fundamental period is N=4. The signal can be
defined one period as xn={0,1,2,3}. By calling the dfs function written in Appendices
section, compute the DFS]
Example 2: A periodic signal is given by
x ( n ) = 1; mN≤n≤mN+L-1
= 0; mN+L≤n≤(m+1)N-1
where m=0,±1, ±2, ……, N is the fundamental period, L/N is the duty cycle.
Find the DFS of the signal and plot the magnitude spectrum for different L and N.
Example 3: Let x(n) be a 4-point sequence define by
x(n) = 1, 0≤n≤3
= 0, otherwise
a. Compute the Discrete Time Fourier Transform (DTFT) of x(n)
b. Compute the 4-point DFT.
c. Compute the 8-point, 16-point and 64 point DFT of x(n.)
d. Compare the results of all DFTs.
Simulation and Measurement:
In this section the corresponding simulation screen-shots should be added, and codes should
be shown in Appendice section.
Questions for report writing:
1. Compare the results with your theoretical understanding and comment on the
findings.
2. Give the clear screen-shots where appropriate and describe what the figures might
mean theoretically.
3. Give the simulation codes at the end of the report.
© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 2
Discussion and Conclusion:
Interpret the data/findings and determine the extent to which the experiment was successful
in complying with the goal that was initially set. Discuss any mistake you might have made
while conducting the investigation and describe ways the study could have been improved.
Reference(s):
1. John G. Proakis & Dimitris G. Manolakis, “ Digital Signal Processing – Principles,
Algorithms and Applications”, Prentice – Hall India, 3rd Edition.
Appendix:
Give the corresponding codes of simulations.
© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 3
Fast Fourier Transforms (FFT)
Abstract:
A fast Fourier transform (FFT) is an algorithm to compute the discrete Fourier transform
(DFT) and its inverse. A Fourier transform converts time (or space) to frequency and vice
versa; an FFT rapidly computes such transformations.
Introduction:
Fast Fourier transforms (FFT) are widely used for many applications in engineering, science,
and mathematics. The basic ideas were popularized in 1965, but some FFTs had been
previously known as early as 1805. Fast Fourier transforms have been described as "the most
important numerical algorithm[s] of our lifetime".
The goal of this lab is to become familiar with Fast Fourier Transform (FFT).
Theory and Methodology:
The Fast Fourier transform (FFT) is an algorithm for computing DFT, before which the DFT
required excessive amount of computation time, particularly when high number of samples
(N) was required. The FFT forces one further assumption, that N is an integer multiple of 2.
This allows certain symmetries to occur reducing the number of calculations (especially
multiplications) which have to be done. Matlab's FFT function is an effective tool for
computing the discrete Fourier transform of a signal. The following code examples will help
you to understand the details of using the FFT function.
Pre-Lab Homework:
1. Study the FFT section in the text/reference book thoroughly.
2. Find out FFT algorithm works
3. Also study the key differences between Fourier Transform and Fast Fourier
Transform.
Apparatus:
• A computer (capable of running MATLABTM)
• MATLABTM (the latest version)
Precautions:
All the computers in the DSP laboratory are running Windows operating system. Unlike
Ubuntu or MacOSX, Windows is very much affected by virus. So to avoid infecting the virus
please double check your USB drive before connecting to the computer.
© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 1
Experimental Procedure:
A. FFT Computation
A.1 The typical syntax for computing the FFT of a signal is FFT(x,N) where x is the
signal, x(n), you wish to transform, and N is the number of points in the FFT. N must be at
least as large as the number of samples in x[n]. To demonstrate the effect of changing the
value of N, synthesize a cosine with 30 samples at 10 samples per period.
A.2 Define 3 different values for N. Then take the transform of x[n] for each of the 3
values that were defined .
A.3 The frequency scale begins at 0 and extends to N-1 for an N-point FFT. Normalize the
scale so that it extends from 0 to 1-1/N.
A.4 Now, plot each of the transforms one above the other.
B. FFT Computation (for larger value of N)
In the last example the length of x(n) was limited to 3 periods in length. Now, let's choose a
large value for N (for a transform with many points), and vary the number of repetitions of
the fundamental period.
C. Spectrum Analysis with the FFT
The FFT does not directly give you the spectrum of a signal. As we have seen with the last
two experiments, the FFT can vary dramatically depending on the number of points (N) of
the FFT, and the number of periods of the signal that are represented. There is another
problem as well. The FFT contains information between 0 and fs, however, we know that the
sampling frequency must be at least twice the highest frequency component. Therefore, the
signal's spectrum should be entirely below fs, the Nyquist frequency. Recall also that a real
signal should have a transform magnitude that is symmetrical for positive and negative
frequencies. So instead of having a spectrum that goes from 0 to fs, it would be more
appropriate to show the spectrum from –fs/2 to fs/2. Accomplish it by using Matlab's shift
function.
Simulation and Measurement: In this section the corresponding simulation screen-shots
should be added, and codes should be shown in Appendice section.
Results and Discussion: Interpret the data/findings and determine the extent to which the
experiment was successful in complying with the goal that was initially set. Discuss any
mistake you might have made while conducting the investigation and describe ways the study
could have been improved.
Questions with answers for report writing:
1. Compare the results with your theoretical understanding and comment on the
findings.
2. Give the clear screen-shots where appropriate and describe what the figures might
mean theoretically.
3. Give the simulation codes at the end of the report. (Handwritten codes)
Reference(s):
1. John G. Proakis & Dimitris G. Manolakis, “ Digital Signal Processing –
Principles, Algorithms and Applications”, Prentice – Hall India, 3rd Edition.
© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 2