Anda di halaman 1dari 3

Discrete Fourier Transform in MATLAB

Discrete Time Fourier Transform (DTFT)


DTFT of a signal x[n] can be defined as:
N −1
X (ω ) = ∑
n=0
x [ n ] e − jw n

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.

Discrete Fourier Transform (DFT)


N point DFT of a signal x[n] is defined as:

N −1
− j ( 2π
∑ x [ n ]e
) kn
X (K ) = N

n=0

and IDFT can be obtained by the relation:

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.

Now you are dividing 2π in N samples.


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

rectpuls ,length , abs , fft , ifft , fftshift

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

t = -5*To : To/50 : 5*To;

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

Remember that cosine signal has Fourier Transform given by


Xc ( w ) = π ∂ [ ω – ωo ] + π ∂ [ ω + ωo ] .Thus you will get the DFT graph having 2
impulses at +2000 Hertz and -2000 Hertz.

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-