Experiment 3: AIM - Write A Matlab Program To Find The DFT (Discrete Fourier Transform) of A
Experiment 3: AIM - Write A Matlab Program To Find The DFT (Discrete Fourier Transform) of A
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)
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-