Code for DFT without using built-in functions | MATLAB
Code:
clc
clear
all
close
all
x=input('Enter the sequence:');
n=input('Enter the time sample:');
N=input('Enter value greater than or equal to length(x)');
if(N>length(x))
for i=1:N-length(x)
x=[x 0];
end
end
X=[];
xx=0;
for k=0:N-1
for n=0:N-1
xx=xx+x(n+1)* exp(-j*2*pi*n*k/N);
end
X=[X xx];
xx=0;
end
No comments