However, because of round-off error, you don't get exactly 0; instead, you get -8.6529e-16. When you take the phase of this element, it's the same as taking the phase of -1, and you get -pi radians.
However, if you plot the magnitude of your FFT result
you'll see that the frequency of your pure tone sinusoid corresponds to the third DFT bin. So, if you look at the angle of this component, you'll find
>> angle(X(3))/pi*180
ans =
-90.0000
So, now your answer is -90 degrees. Why? The phase of sin(0) is 0 if you're defining the phase relative to a zero-phase sine -- but the phase of the DFT coefficients is relative to a zero-phase cosine. This is why you get a phase of -pi/2 in radians (-90 degrees).
If you need to convince yourself this is the case, try repeating the process, but replace x with
You'll see you get the same FFT results (minus some roundoff error).
Incidentally, if you wanted the phase of the FFT results to be relative to a zero-phase sine, you don't have to do much different; you just have to multiply your input by 1j:
>> X = fft(1j*x);
>> angle(X(3))*180/pi
ans =
-1.5876e-14
Best Answer