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


but Matlab's fft gives

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


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?


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];

   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];

   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.

  • $\begingroup$ Nope. Matlab produces the correct result: 2.0000 1.0000-1.0000i 0 1.0000+1.0000i. Be careful using the transpose operator when looking at the results $\endgroup$
    – Hilmar
    Mar 17, 2013 at 23:34
  • $\begingroup$ yes, just noticed it myself. I was using transpose on the row result to see it better. I should have used non-conjugate transpose. my error. fft result is same order as formula. all ok. $\endgroup$
    – Robert H
    Mar 17, 2013 at 23:40

1 Answer 1


Octave returns your same first result:

octave-3.2.3:1> 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.