I tend to forget how to recover a frequency spectrum from a series of data points using the FourierSeries
(read as: I forget how to compute the frequency corresponding to a specific channel in the fourier series). To stop me from forgetting I came up with the following quick and dirty module. It takes a one-dimensional list of data points that were taken over a time interval of timelength
and returns a list containing pairs of {Frequency, complex amplitude}
. As you can see the frequency is simply (number of data point – 1) divided by the time interval covered by the data. A quick plausibility check confirms this result: Data point 0
corresponds to the offset of the fourier series (frequency 0
). The maximum observable frequency (found at position (number of data points / 2)) is (number of data points / 2) per timelength
and in agreement with the Nyquist frequency.
FourierFreqs[data_, timelength_] :=
Module[{},
Transpose[
{((Range[Length[data]] - 1))/timelength,
Fourier[data]}
]
]