DFT in MATLAB Using FFT
DFT in MATLAB Using FFT
It gives frequency spectrum of the signal. Since ω is continuous, its range is continuous. So it is
impossible to get a vector in MATLAB which covers entire range of the DTFT.
N −1
− j ( 2π
∑ x [ n ]e
) kn
X (K ) = N
n=0
N −1
1 − j ( 2π
∑
) kn
x[ n ] = X (k )e N
N k =0
N point DFT means taking N equidistant samples (Sampling in frequency domain). DFT is a
sampled version of DTFT.
2π
Width = N
In order to estimate DTFT of the signal, we may take DFT of the signal, while taking large
number of DFT points.
-1-
Fast Fourier Transform (FFT)
FFT is an efficient algorithm of calculation of DFT. It requires much less computation, but it
requires the number of samples to be an integer power of 2. MATLAB provides FFT command
to compute DFT using FFT algorithm
Problem # 1:
The following functions are required in this lab
Read the help of these Matlab functions understanding the input and output parameters.
Problem # 2:
Consider the time vector given below
inc = 0.001;
t = -0.2+inc:inc:0.2;
Plot the magnitude of DFT of Rectangular pulse having width 0.025 and defined for the time
given above. Use the Matlab functions “ rectpuls ” & “ fft ”.The DFT should be centered around
zero. Use function “ fftshift ” to shift zero-frequency component to center of spectrum
Problem # 3:
Consider a continuous time signal xc ( t ) = cos ( 4000 π t ) defined for the time given below
Here To is the Time Period of xc ( t ). Plot the signal and the magnitude of DFT for this cosine
signal versus frequency values. Choose a value of “ N ” which is higher than the signal length
Problem # 4:
Plot the Inverse DFT for problem 3.Graphs for Problem 3 and 4 are shown below
-2-
1
-1
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
Cosine Signal xt = cos(4000*pi*t) -3
x 10
300
200
100
0
-50 -40 -30 -20 -10 0 10 20 30 40 50
DFT of cosine ( Frequency Axis in KHz )
1
0.5
-0.5
-1
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
Inverse Discrete Fourier Transform IDFT -3
x 10
-3-