# Why this two ways of FFT are different?

I have a small question that I am confused.

N=16;
x=[-pi:2*pi/N:pi-2*pi/N];
y=1.5*cos(x)
z=fft(y)/N


we will get negtive Fourier coefficients, however when we do it in this way:

N=16;
x=[0:2*pi/N:2*pi-2*pi/N];
y=1.5*cos(x);
z=fft(y)/N


we get positive ones. How to explain this? Thank you very much!

• This is a question about MATLAB programming, not signal processing. I vote to close. – Dilip Sarwate Jul 19 '12 at 14:42
• I think the fundamental question regards the meaning of the phase of DFT coefficients. The Matlab code is just a manifestation. – Mark Borgerding Jul 20 '12 at 11:24