# matlab's FFT is wrong? don't think so

i'm trying to get an FFT of a signal

my FFT has 1024 samples

i added two sin functions one of freq 86,13Hz (2*44100/1024) and one of freq 129,19Hz (3*44100/1024)

the WAV looks like that (for 1 period) :

i then use this code to inspect the FFT

FFTSize = 1024;

current_window = zeros(FFTSize, 1);

for k = 1:length(Y)/(FFTSize)

for m = 1:FFTSize
current_window(m, 1) = Y((k-1)*(FFTSize)+m, 1);
end;

plot(current_window)

a = abs(Ydft);
p = angle(Ydft);

end;


the bins 2 and 3 have the maximum amplitude of 256 which is right as i used two sin of frequency 2 and 3

but when i look at the phases they are -pi/2 which is weird as they should be 0 no ?

here are the phases :

so you see they are -pi/2, why is that ?

and here is the WAV file i used so you can try yourself: http://www.khaelis.com/tmp/2sins.zip

thanks for help

Jeff

• @ionone, neither. It decomposes into complex exponentials $\exp(i \omega) = \cos(\omega) + i \sin(\omega)$ – Jazzmaniac Apr 14 '14 at 11:08