Hi,
I wrote a recursive FFT program. But when I run the program, the result is wrong. Can someone help me to find the problems in the code? Thanks!
Jian
function F = fft_rec(f)
n = length(f);
if (n == 1)
F = f;
else
f_even = f(1:2:n);
f_odd = f(2:2:n);
X1 = fft_rec(f_even);
X2 = fft_rec(f_odd).*Wn(n);
F1 = X1 + X2;
F2 = X1 - X2;
F = [F1 F2];
end
function W = Wn(n)
m = n/2;
w = exp(-2*pi*j.*[0:1:m-1]/n);