from
Radix2 decimation in time 1D fast Fourier transform FFT
by Gylson Thomas
The function implement the 1D radix2 decimation in time fast Fourier transform FFT algorithm
|
| X=fftf(data)
|
function X=fftf(data)
% This funciton Compute the Radix-2 decimation in time FFT
% Author: Gylson Thomas
% e-mail: gylson_thomas@yahoo.com
% Asst. Professor, Electrical and Electronics Engineering Dept.
% MES College of Engineering Kuttippuram,
% Kerala, India, December 2006.
% copyright 2006.
N = length(data);
X=bitrevorder(data);
L=log2(N);
k1=2; k2=N/2; k3=1;
for i1=1:L %Iteration stage
L1=1;
for i2=1:k2
k=1;
for i3=1:k3
i=i3+L1-1; j=i+k3;
W=complex(cos(2*pi*(k-1)/N),sin(2*pi*(k-1)/N));
T=X(j)*W;
X(j)=X(i)-T; X(i)=X(i)+T;
k=k+k2;
end
L1=L1+k1;
end
k1 = k1*2; k2 = k2/2; k3 = k3*2;
end
function X=ffti(data)
% This function compute the Radix-2 decimation in time inverse FFT
% Author: Gylson Thomas
% e-mail: gylson_thomas@yahoo.com
% Asst. Professor, Electrical and Electronics Engineering Dept.
% MES College of Engineering Kuttippuram,
% Kerala, India, December 2006.
% copyright 2006.
N = length(data);
X=conj(bitrevorder(data));
L=log2(N);
k1=2; k2=N/2; k3=1;
for i1=1:L %Iteration stage
L1=1;
for i2=1:k2
k=1;
for i3=1:k3
i=i3+L1-1; j=i+k3;
W=complex(cos(2*pi*(k-1)/N),sin(2*pi*(k-1)/N));
T=X(j)*W;X(j)=X(i)-T; X(i)=X(i)+T;
k=k+k2;
end
L1=L1+k1;
end
k1 = k1*2; k2 = k2/2; k3 = k3*2;
end
X=conj(X)./N;
|
|
Contact us at files@mathworks.com