# [FieldTrip] FFT question

Robert Oostenveld r.oostenveld at donders.ru.nl
Tue Aug 25 12:38:06 CEST 2015

```On 25 Aug 2015, at 02:34, Ben Hutchinson <benhut1 at gmail.com> wrote:

> I was looking at your webpage on the FFT here http://www.fieldtriptoolbox.org/tutorial/fourier and noticed that the for an ordinary sinewave, like sin(x), the imaginary component of the FFT actually has a negative spike on the left side and a positive spike on the right side. Why is this? I thought that the left side of an FFT had the coefficient of the sinewave, and the right side of the FFT had the negative of that. So with a regular sinewave, (such as sin(x) which is actually the same as coef*sin(x) where coef=1) the left side of the imaginary part of the FFT is supposed to show that coefficient, meaning that it should have a spike of positive 1. But the FFT on this webpage instead shows a spike of -1 at that location. Why is that?

Hi Ben

from Matlab "help fft"

For length N input vector x, the DFT is a length N vector X,
with elements
N
X(k) =       sum  x(n)*exp(-j*2*pi*(k-1)*(n-1)/N), 1 <= k <= N.
n=1
The inverse DFT (computed by IFFT) is given by
N
x(n) = (1/N) sum  X(k)*exp( j*2*pi*(k-1)*(n-1)/N), 1 <= n <= N.
k=1

Note the “-j” in the first equation.

See page 158 in http://www.dspguide.com/CH8.PDF and specifically equation 8.3 on page 153, which explains it in more detail. I recommend the DSP guide as a general resource to learn more about digital signal processing.

best regards,
Robert

PS please address future questions to the email discussion list (CC) so that other people can benefit from it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150825/1bc2095b/attachment-0001.html>
```