Need help in understanding the following FFT code (line %1 to %4)
1 view (last 30 days)
Show older comments
function [ y ] = FFT_DIT_R2( x )
p=nextpow2(length(x));
x=[x zeros(1,(2^p)-length(x))];
N=length(x);
S=log2(N);
Half=1;
x=bitrevorder(x);
for stage=1:S;
for index=0:(2^stage):(N-1);
for n=0:(Half-1);
pos=n+index+1;
pow=(2^(S-stage))*n; %1
w=exp((-1i)*(2*pi)*pow/N); % 2
a=x(pos)+x(pos+Half).*w; % 3
b=x(pos)-x(pos+Half).*w; % 4
x(pos)=a;
x(pos+Half)=b;
end;
end;
Half=2*Half;
end;
y=x;
end
0 Comments
Answers (0)
See Also
Categories
Find more on Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!