Search This Blog

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

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();