Does anyone know any FFT algorithm that can be implemented in C? I am trying to convert a built-in matlab FFT api to a function in C.

Appreciate any help!

  • 2
    $\begingroup$ Do you have specific problem regarding the theory behind the implementation ? If so - edit your question. $\endgroup$ – Sektor Feb 1 '14 at 14:24
  • $\begingroup$ A google search returns far too many results. Many in C. $\endgroup$ – hotpaw2 Feb 1 '14 at 17:31

I just did exactly what you are asking for a few weeks ago. Try the Matlab coder. It turns your scripts into C funtions. This is what i did, maybe you can try it and see if it works for you:

1 - Make a simple function in matlab like this

function [y] = myfft(x)

y = fft(x,2^nextpow2(length(x)));

end 2 - Run the matlab coder.

3 - Set the input values to double and sizes of the inputs and outputs (You can read a little bit of the help for this, it is easy to understand).

4 - Build a static library based on this code

The result was that matlab created a few source and header files with initialization code, as well as a function with the actual algorithm, i think it used a global variable for the twiddle factors in the Cooley-Tukey algorithm and then just performed the radix-2 computations. So i ended up with the complete source code as well as the compiled myfft.so binary to include in any desired project.

Try it out, maybe you'll need to do some configurations, i use linux so i guess it was implied for matlab that the compiler would be gcc.

Hope it helps,

| improve this answer | |
  • $\begingroup$ Unfortunately, i do not have matlab software to convert. Thanks for your input though, appreciate it! $\endgroup$ – user3187494 Feb 1 '14 at 15:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.