# Phase of the FFT of a sine function

I'm trying to wrap my mind about what happens in Matlab/Octave when you compute the fft of a sine function. Theoretically, the Fourier Transform of a sine is given by two delta functions multiplied by the imaginary unit (one placed at the frequency of the sine and another at minus the frequency). I can see that in the modulus of the FFT (not exactly a delta because of the frequency leakage due to the windowing), but when I check the phase I get a signal that is non-zero over all the support (from 0 to the sampling frequency). I'm playing with this toy example in Octave:

fs = 200,t=-10:(1/fs):10;
x = sin(2*pi*30*t);
f = linspace(0,1,length(x))*fs;
fourierTrans = fft(x);
figure,plot(f,abs(fourierTrans))
figure,plot(f,angle(fourierTrans))


And the picture I get for the phase is: Why is it that I don't see two deltas in the picture for phase of amplitude pi/2 and -pi/2?

Cheers

• Remember that even with a "perfect" FFT where the signal only occupies 1 bin, the bins that are not signal will have computation noise in them; they will never be exactly 0. So the phase everywhere will be nonzero, even though it's meaningless. – endolith Sep 12 '13 at 20:08