0

I know there are already a lot of questions about frequency bins in FFT. However I have one that doesn't really fit to the ones I read. I have time dependent data where the time does not start at t=0 but later. The question I have is how I define the frequency bins of the result in this case. The common convention as I understood it is to assign a value of k/tMax to the k-th bin, which makes sense if t0=0. But if I use this approach on my data the result of a FFT->iFFT is phase shifted to the original data. The same problem arises then of course in the iFFT part.

Is it required to pad the data to the left with zeros in order to fill it up to t=0 or is there another way?

Also I compared my results to results I got with the Origin software for the same data and the binning is slightly different. My maximum time in the data is 1.9792. I calculate for the first bin a frequency of 0.50525 but Origin gets a value of 0.49736. Isn't it just 1/1.9792=0.50525?

Jens
  • 167

1 Answers1

0

If you do a FFT on some data segment then you consider this data segment as part of a periodic function. Assume you have a segment of $N$ samples in an index segment $[a:b-1]$

  • starting at time index $a=jN+k$ and
  • ending at $b-1$ where $b=a+N=(j+1)N+k$.

added: which means $j=a \;div\; N$ and $k=a\; mod\;N=a-jN$.

Then the amplitudes of the spectrum with correct phase are obtained by considering the segment $[0:N-1]$ of the periodically continued segment.

In practical terms this means that you split the segment before index $(j+1)N$ and join the parts in the reverse order,

  • $[(j+1)N:(j+1)N+k-1]=[(j+1)N:b-1]$ mapped to $[0:k-1]$ first and
  • $[jN+k:(j+1)N-1]=[a:(j+1)N-1]$ mapped to $[k:N-1]$ after that.
Lutz Lehmann
  • 126,666
  • 1
    Always considering the sample to be a periodic function is a good point. That explains the result being a phase shift. I got a little confused after that: Could you explain what j and k are? Thank you. – Jens Jan 18 '14 at 10:27
  • $j$ and $k$ are quotient and remainder of the integer division of the starting index $a$ by the period $N$. – Lutz Lehmann Jan 18 '14 at 11:00