Fast Fourier transform: Difference between revisions

Line 619:
 
<lang MATLAB> fft([1,1,1,1,0,0,0,0]')
 
function d = myfft(x)
 
if x>1
l2 = L/2;
a = myfft(x(1:2:L-1));
b = myfft(x(2:2:L));
c = (cos(2*pi*L^-1)-j*sin(2*pi*L^-1)).^[0:l2-1];
c1 = c.*b;
d = [(a+c1),(a-c1)];
else
d = x;
end
 
</lang>
Output:
Line 631 ⟶ 645:
0.00000 - 0.00000i
1.00000 + 2.41421i</pre>
 
 
=={{header|OCaml}}==
Anonymous user