资源简介
基于时域抽取法的基二fft源程序!MATLAB语言!
代码片段和文件信息
%时域抽取法基2FFT通用源程序
%若xn长度不足N则补零至NN为2的整数次幂
function Xk=n_fft(xnN)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%第一步:补零并调用倒序子程序
if length(xn) xn=[xnzeros(1N-length(xn))];
end
xn=bit_reversal(xn); %倒序程序
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%第二步:构造运算流图
L=log2(N); % 级数
%构造第一级
G=zeros(NL);
for ii=1:(N/2)
G(2*ii-11)=ii;
G(2*ii1)=ii;
end
%构造第2级到第L级
for ii=2:L
di=2^(ii-2);
g=G(:ii-1);
for jj=1:(N/2)
pos=find(g==jj);
num=floor(pos(1)/(2^(ii-1)))+1;
if mod(num2)==1
P=pos(2);
else
P=pos(1);
end
G(P+diii)=jj;
G(P-diii)=jj;
end
end
%第三步:构造翅权数据
CQ=zeros(N/2L);
for ii=1:L
Jmax=2^(ii-1)-1;
JJ=(2^(L-ii)).*[0:Jmax];
for k=1:length(JJ)
JJ(k)=cos(2*pi*JJ(k)/N)+i*sin(2*pi*JJ(k)/N
评论
共有 条评论