# Am I understanding the phase angle from FFT correctly?

Long story short, I have a sinusoidal wave with DC offset going in with a given frequency of say 100 Hz and $\phi = 0$ (which I'm guessing is really $\pi/2$ since it is a sine wave not cosine). I get an output of the same frequency and, using FFT, I would like to find the phase between these two. What I did is I found the peak frequencies (-100 and 100 Hz), found their bin and from the same bin I extracted the amplitude and the phase.

Is that correct?

-

## migrated from stackoverflow.comApr 15 '13 at 17:17

This question came from our site for professional and enthusiast programmers.

The phase is relative to the start of the sample window, and unless the frequency component corresponds exactly with the center frequency of the relevant FFT bin then you also need to apply a correction.

-
That's a very good point. Any chance that you could add an explanation and/or example? –  Jim Clay Apr 15 '13 at 17:29
Sure - I'll try and find some time to add more detail later today. –  Paul R Apr 15 '13 at 18:03
The phase is relative to BOTH the start and end of the FFT window. Thus the problem for non-periodic signals unless one applies an fftshift. –  hotpaw2 Apr 15 '13 at 22:48
@jimclay : See my answer for a method to get a more correct phase (to a different reference point). –  hotpaw2 Apr 15 '13 at 22:49
Yes, the more I think about it the more it seems that using an FFT to extract phase information is the wrong approach - it can only really work if you know the exact frequency of the component of interest, which makes it useless for most practical applications. –  Paul R Apr 16 '13 at 6:46