I have a periodic series of 360 values. How can I use the fftw c libraries to get the amplitude and phase of the first, second, third and fourth harmonic?
If I do this for N=360
fftw_plan_r2r_1d(N,input_array,output_array,FFTW_R2HC,FFTW_ESTIMATE);
I can get the 360-point Discrete Fourier Transform (DFT) where output_array is complex Hermitian in half-complex format.
Where k$^{th}$ component of output_array is the real part and (N-k)$^{th}$ component of output_array is the imaginary part.
So if I want the amplitude or magnitude(??) of the first harmonic should I do this?
ampl_1sth=sqrt(output_array[1]*output_array[1]+output_array[N-1]*output_array[N-1])
Is that correct? then the amplitude of the second harmonic will be the same but with output_array[2] and output_array[N-2] and so on right?
And then how can I get the phase of the first, second, third and fourth harmonic with the info from the DFT?
For a reference to fftw see here www.fftw.org/fftw3.pdf
Thank you.