Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for i=1:256
- x(i) = sin(2*pi*i*80) + sin(2*pi*i*46);
- end
- X = zeros(256,1);
- for k=1:256
- for n=1:256
- X(k)=X(k) + x(n)*exp((-j*2*pi*(n-1)*(k-1))/256);
- end
- end
- built_in = fft(x);
- error = abs(X) - abs(built_in)';
- plot(abs(X)); hold on
- plot(abs(built_in));
- plot(error);
- legend('My code', 'Matlab','error');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement