RTRT是实验二中那个自己实现FFT算法的程序,我的程序是下面这个,但算256点的DFT很慢..........
求强人看看
function xk=myfft1(x,N)
if (N>length(x))
x=[x,zeros(1,N-length(x))];
else if (N<length(x))
error('N must not be lower than the length of x');
N=length(x);
end
end
l=ceil(log2(N));
x=[x,zeros(1,(2^l-N))];
N=2^l;
W=exp(-i*2*pi/N);
x1=zeros(1,N/2);
x2=zeros(1,N/2);
for p=1:N/2
x1(p)=x(2*p-1);
x2(p)=x(2*p);
end
if(N>2)
for k=1:N/2
xk1=myfft1(x1,N/2);
xk2=myfft1(x2,N/2);
xk(k)=xk1(k)+xk2(k)*(W^(k-1));
xk(k+N/2)=xk1(k)-xk2(k)*(W^(k-1));
end
else
xk(1)=x(1)+x(2);
xk(2)=x(1)+W*x(2);
end
没写注释,但还只是简单的嵌套而已........