Click here to Skip to main content
15,896,259 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was writing a code for fft where the user will input the number of samples. How do i loop all the butterfly diagrams so that it becomes an efficient program. what is the common factor between each stage of the butterfly diagram using which i can run a loop ???
Posted

There are tons of FFT algorithms around and the web is full of good descriptions of the theory and the algorithms. Why don't you start with a web search (google), develop some code, and come back here in case you run into problems.
 
Share this answer
 
Comments
Member 11330011 29-Dec-14 5:50am    
I like do fft for 1024 samples using c/c++ coding.What can i do?Please help me.
nv3 29-Dec-14 18:46pm    
Just google "FFT algorithm C++" and you will find lots of code. If you want to understand what you are doing, perhaps start with
http://en.wikipedia.org/wiki/Fast_Fourier_transform
and keep on reading.
i have written the code for the first stage butterfly which is :
C++
for (k=0;k<m;k++)
{
    while (l    {
        if (k%2==0)
        INT[k]=input[l]+W[0]*input[l+m/2];
        else
        INT[k]=input[l]+W[m/2]*input[l+m/2];
        l=l+1;
     }
}

but for the next stages there are too many variables like the input sample, the output sample,the twiddle factor.the problem i am facing is that i cant find a relation between them and hence cant understand how to run a loop so that the whole butterfly can be solved.
 
Share this answer
 
v2
Look up Cooley-Tukey algorithm on wiki, which has links to "simple, pedagogical" C and C++ implementations:

http://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm#Pseudocode[^]

Cooley-Tukey always was considered an FFT classic.
 
Share this answer
 
v3
Comments
Member 11330011 29-Dec-14 6:18am    
How the coding can be done in processor?please help me..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900