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
The phase of a sinewave that is not exactly periodic relative to the FFT aperture length is discontinuous at the edges.  If you want a sane/visualizable phase (not the phase of a discontinuity) for non-periodic frequencies, try generating your sinewave with a known phase at the center of the FFT (sin(2*pi*foo*(t-N/2))), and use an fftshift to re-reference the reported phase result of the FFT to the center of the FFT aperture as well.  Then the oddness/evenness ratio of your test function, and thus the phase result will remain stable as frequency is swept between FFT bin center frequencies.

The phase of a non-periodic-in-aperture sinewave will contain the phase of the convolution of the signal with the transform of the FFT window (something like a Sinc, which ends up spanning the full width of the FFT), which will also have a phase related to that of the signal.  Even a computed FFT of an exactly periodic sinewave will also produce some values that aren't exactly zero in all the other bins due to quantization noise in the computer arithmetic; thus those essentially zero, but not quite zero, magnitudes will have a phase that may or may not be zero.  And the phase of an actual zero magnitude vector is indeterminate, not necessarily zero.