I have data corresponding to time and amplitude of a sound wave. The times are in even intervals (i.e. a measurement is taken every second). x[i] is the time of the ith measurement and y[i] is the corresponding amplitude at that time. How do I take the FFT of this data so that I have it in the frequency domain?
Any help would be greatly appreciated. Thank you in advance.
You want the “R2C” option. See FFTW documentation for the correspondence between the output bins and physically meaningful frequencies. I believe that you must also have FFTW installed and you have to have configured ROOT to use it when you installed ROOT (see ROOT’s installation instructions). Hope that helps.
Yes - thank you, I have already looked over that tutorial a great deal. It is difficult to understand because the tutorial does a number of different things all in the same code. I’m not sure what applies directly to my problem. Could anyone please tell me which parts of the code specifically to use? Again, I’m only trying to take the FFT of the data. Shouldn’t it be fairly straightforward?
This may not be much simpler, but it is the simplest example I have that does a FFT like you want. I use it to transform time domain signals into frequency domain. It makes a simulated white noise time domain signal (or you can comment lines 55-60 and uncomment the lines above for a sawtooth wave). It will plot the original signal, the magnitude and phase of the complex transform and then do the inverse transform to show that you get back exactly the original signal (if you are careful about the way FFTW handles normalizations). The plots down the right column are some diagnostics that are likely not interesting to you (I wanted to diagnose the whiteness of my simulated noise). This file needs to be compiled, but I imaging you can easily run it in the CINT interpreter. main.cpp (4.76 KB)