Author Topic: fft recursive program  (Read 1612 times)

Offline Jian

  • Newbie
  • *
  • Posts: 1
  • Matlab Forum
    • View Profile
fft recursive program
« on: March 14, 2011, 10:47:01 PM »
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);

Matlab and SimuLink Development Forum

fft recursive program
« on: March 14, 2011, 10:47:01 PM »