confusion regarding code of FFT decimation in time?

1 view (last 30 days)
ABTJ
ABTJ on 16 Jun 2020
Edited: ABTJ on 16 Jun 2020
Below is the code , i got it from MATLAB FEX.
Although i am getting valid answers using this function but I am confused regarding value/variable "Half" and its justification in context/view of decimation in time
function [ y ] = FFT_DIT_R2(x)
p= nextpow2(length(x)) % checking the size of the input array
x= [x zeros(1,(2^p)-length(x))] % complementing an array of zeros if necessary
N= length(x) % computing the array size
S= log2(N) % computing the number of conversion stages
Half= 1 % Seting the initial "Half" value
x= bitrevorder(x)
for stage= 1:S % stages of transformation
stage
for index= 0:(2^stage):(N-1) % series of "butterflies" for each stage
index
for n= 0:(Half-1) % creating "butterfly" and saving the results
n
pos= n+index+1 % index of the data sample
pow= (2^(S-stage))*n % part of power of the complex multiplier
w= exp((-1i)*(2*pi)*pow/N) % complex multiplier
a= x(pos)+x(pos+Half).*w % 1-st part of the "butterfly" creating operation
b= x(pos)-x(pos+Half).*w % 2-nd part of the "butterfly" creating operation
x(pos)= a % saving computation of the 1-st part
x(pos+Half)= b % saving computation of the 2-nd part
end;
end;
Half= 2*Half % computing the next "Half" value
end;
y= x; % returning the result from function
end

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!