Code covered by the BSD License  

Highlights from
dft.m

dft.m

by

 

computes 1-D fourier transform

dft.m
clc; close all; clear all;
x= input('enter the sequence x:');
l=length(x);
subplot(1,2,1);
stem(x);
for k=1:length(x)
    y(k)=0;
    for n=1:length(x)
         y(k)=y(k)+x(n)*exp(((-1i)*2*pi*(n-1)*(k-1))/l);
    end;
end;
subplot(1,2,2);
disp('X=');
disp(y);
a=complex(real(y));
b=complex(imag(y));
stem(a,b);
xlabel('Real(x)-->');
ylabel('Imag(x)-->');

Contact us