# Discrete Fourier Transform in MATLAB

Discrete Time Fourier Transform (DTFT)
DTFT of a signal x[n] can be defined as:

X (ω ) =

N −1 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:

X (K ) =

∑ x [ n ]e
n=0

N −1

− j ( 2π

N

) kn

and IDFT can be obtained by the relation:

1 x[ n ] = N
Now you are dividing 2π in N samples.

N −1 k =0

X (k )e

− j ( 2π

N

) kn

N point DFT means taking N equidistant samples (Sampling in frequency domain). DFT is a sampled version of DTFT.

Width =

2π N

In order to estimate DTFT of the signal, we may take DFT of the signal, while taking large number of DFT points.

-1-

2+inc:inc:0. abs .The DFT should be centered around zero. t = -0. 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. 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 ] . Here To is the Time Period of xc ( t ).length .Fast Fourier Transform (FFT) FFT is an efficient algorithm of calculation of DFT. Use the Matlab functions “ rectpuls ” & “ fft ”. Plot the signal and the magnitude of DFT for this cosine signal versus frequency values. but it requires the number of samples to be an integer power of 2. It requires much less computation. fftshift Read the help of these Matlab functions understanding the input and output parameters.2. Problem # 4: Plot the Inverse DFT for problem 3. MATLAB provides FFT command to compute DFT using FFT algorithm Problem # 1: The following functions are required in this lab rectpuls .Graphs for Problem 3 and 4 are shown below -2- . Problem # 2: Consider the time vector given below inc = 0.Thus you will get the DFT graph having 2 impulses at +2000 Hertz and -2000 Hertz.001. fft . ifft . Plot the magnitude of DFT of Rectangular pulse having width 0.025 and defined for the time given above.

5 0 0.5 0 0.5 -2 -1.5 -1 -0.5 -2 -1.5 2 x 10 2.5 Cosine Signal xt = cos(4000*pi*t) 1 1.5 -3 300 200 100 0 -50 1 0.5 1 Inverse Discrete Fourier Transform IDFT 1.5 -3 -40 -30 -20 -10 0 10 20 DFT of cosine ( Frequency Axis in KHz ) 30 40 50 -3- .1 0 -1 -2.5 -1 -0.5 0 -0.5 -1 -2.5 2 x 10 2.