fft result order compared to direct implementation of DTFS using text book To find the complex Fourier coefficients of this sequence, then The $k^{th}$
coeff. $c[k]$ is given by the DTFS formula

$$
c[k]=%
%TCIMACRO{\dsum \limits_{n=0}^{N-1}}%
%BeginExpansion
{\displaystyle\sum\limits_{n=0}^{N-1}}
%EndExpansion
x[n]\exp(-in\frac{2\pi}{N}k)
$$

(Lets forget about the $1/N$ scaling for now). My question is on the ordering
of the result.

For example, given $x=[1,1,0,0]$, hence $N=4$. Then applying the above gives

$c[0]=2,c[1]=1-i,c[2]=0,c[3]=1+i$

but Matlab's  fft  gives

c=fft([1 1 0 0]);


$c[0]=2,c[1]=1+i,c[2]=0,c[3]=1-i$

So matlab's $c[1]$ is the formulas $c[3]$ and Matlab's $c[3]$ is the formulas
$c[1]$. So the order seems to be swapped around.

Ofcourse they are still complex conjugate of each others. So both answers are correct.

My question is on the order of terms and why they come out this way.

Any thought on what that is, and why the result is not in the same order as
the formula gives? And if it is possible to make fft give the same order as the formula?

add

I found the problem. I used transpose to change row result from fft to column to make it easy to see. But I did not use the correct tranpose.

When I transposed the result, which was a row, to a column to easier to see, the terms got switch around. Here is an example

z=[1 2+1i 3 4+1i];
z'

   1.0000 + 0.0000i
   2.0000 - 1.0000i
   3.0000 + 0.0000i
   4.0000 - 1.0000i


I should have used non-conjugate tranpose:

z=[1 2+1i 3 4+1i];
z.'

   1.0000 + 0.0000i
   2.0000 + 1.0000i
   3.0000 + 0.0000i
   4.0000 + 1.0000i


So, terms are in correct order all along.

User error. sorry.
Octave returns your same first result:

octave-3.2.3:1&gt; fft([1 1 0 0])
ans =

   2 + 0i   1 - 1i   0 + 0i   1 + 1i


While 4*ifft([1 1 0 0]) results in what you claim is Matlab's result.

Please check you are not confusing direct and inverse FFT.