% test of myfft implementation N = 128; x = randn(N,1) + i*randn(N,1); y0= fft(x); y1= myfft(x); norm(y0-sqrt(N)*y1)/norm(y0) % computational complexity Ns = 2.^(1:16); Nops= zeros(size(Ns)); for N=Ns, x = randn(N,1) + i*randn(N,1); [y,nop] = myfft(x); Nops(round(log2(N))) = nop; end loglog(Ns,Nops,'rx',... Ns,log2(Ns).*(2*Ns-1),'b',... Ns,2*Ns-1,'m'); grid on; xlabel('N'); ylabel('complexity'); legend('FFT','O(N log(N))','O(N)',... 'Location','Best');