文件名称:数字信号处理自己编写的FFT程序
文件大小:780KB
文件格式:DOCX
更新时间:2023-01-18 12:53:38
数字信号处理
function [FX]=myfft(x) N0=length(x); if N0==1 FX=x; else N0>1 N=2^ceil((log(N0))/(log(2))); for i=0:(N/2)-1 x1(i+1)=x(2*(i+1)); x2(i+1)=x(2*(i+1)-1); end FX1=myfft(x1); FX2=myfft(x2); WN=exp(-j*2*pi/N); for i=0:(N/2)-1 FX(i+1)=FX1(i+1)+(WN^(i+1))*FX2(i+1); FX(i+1+(N/2))=FX1(i+1)-(WN^(i+1))*FX2(i+1); end end k=[0:1:N0-1]; figure(2); subplot(2,1,1); stem(k,x(k+1)); xlabel('n'); ylabel('x(n)'); subplot(2,1,2); stem(k,abs(FX(k+1))); xlabel('k'); ylabel('|FX(k)|'); end