0% found this document useful (0 votes)
22 views

Experiment 3: AIM - Write A Matlab Program To Find The DFT (Discrete Fourier Transform) of A

The document describes an experiment that uses MATLAB to calculate the discrete Fourier transform (DFT) of a sequence. The program takes in the length of the DFT (N) and the sequence (x) as inputs, calculates the DFT using a for loop operation, and plots the results across three subplots showing the sequence, magnitude, and phase.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Experiment 3: AIM - Write A Matlab Program To Find The DFT (Discrete Fourier Transform) of A

The document describes an experiment that uses MATLAB to calculate the discrete Fourier transform (DFT) of a sequence. The program takes in the length of the DFT (N) and the sequence (x) as inputs, calculates the DFT using a for loop operation, and plots the results across three subplots showing the sequence, magnitude, and phase.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

EXPERIMENT 3

AIM Write a matlab program to find the DFT (discrete fourier transform) of a sequence SOFTWARE TOOLS REQUIRED MATLAB 7.0 THEORY-

PROGRAM MATLAB CODE %discrete fourier tramsform of the sequence% N=input('Length of DFT'); x=input('Enter the sequence='); L=length(x); if (N>L) error('Length of sequence must be equal to N') end x1=[x zeros(1,N-L)]; n=0:1:L-1 subplot(3,1,1) stem(n,x1) title('sequence') xlabel('time index') ylabel('sampled value') for k=0:N-1 for n=0:N-1 w=exp(-2*pi*i*k*n/N); x2(k+1, n+1)=w; end end xk=x1*x2 k=0:1:N-1 M=abs(xk) subplot(3,1,2) stem(k,M) xlabel('time index') ylabel('sampled value') title('sequence') A=angle(xk)

subplot(3,1,3) stem(k,A) xlabel('time index') ylabel('sampled value') title('final dft')

COMMAND WINDOWLength of DFT3 Enter the sequence=[1 2 3] n= 0 xk = 6.0000 k= 0 M= 6.0000 A= 0 >> 2.6180 -2.6180 1.7321 1.7321 1 2 -1.5000 + 0.8660i -1.5000 - 0.8660i 1 2

RESULT- The DFT (discrete fourier tramsform) of the signal is taken out and the output figure is shown.

FIGURES-

You might also like