# Fast Fourier Transform in C

I have a time domain data of an electric field(windowed) at a point, say $(x,y)$. The time is around 33 picoseconds and sampled at 20,000 points.

To convert this data to frequency domain I am using FFT. The steps I follow are:

1) I take the Fourier transform of the electric field in a frequency range (say $f_1$ to $f_2$ in 20,000 points) and over the time interval of 33 picoseonds and get complex amplitude from this step.

2) Now I take the norm of the complex amplitude to get the magnitude of complex amplitude.

3) I find the phase$(-\pi, \pi)$ using real and imaginary parts of the complex amplitude in the defined frequency range.

4) Now I multiply the cosine of the phase with the magnitude of the complex amplitude to get the real part of the complex amplitude.

5) Then I plot the absolute value of the real amplitude versus frequency.

However, after doing all of this, I don't obtain the right frequency spectrum. I don't know whether my procedure is correct or not. I guess, the problem might be with sampling.

Can someone comment on it.

• In step 2, you "take norm of the complex amplitude to get the real amplitude" and in step 4, you "multiply phase with norm of complex amplitude to get the real amplitude" -- only one of these is correct. Also, multiplying with the phase (a number between $0$ and $2\pi$ - or maybe between $-\pi$ and $\pi$) does not look like a sensible step anyway – Hagen von Eitzen Nov 6 '17 at 17:44
• Actually in step 2 I meant, take norm to get magnitude of complex amplitude. Then I multiply this magnitude with cosine of phase to get real part of the amplitude. I will correct it. – Jitendra Nov 6 '17 at 17:47