# Frequency vector and FFT

Hi everybody,

I’ve got a question concerning the definition of the frequency array and the FFT usage. For simplicity, let’s assume that:

```Nx = 4096; T = 600 [s];```

This means that the Nyquist frequency (or cut-off frequency) is

`` fn = Nx/T = 4096/600 [Hz] = 6.82667 [Hz]; ``

while the minimum frequency value will be ``` fmin = 1/600 [Hz] = 0.00167 [Hz] ```.

Generally, for FFT application’s purposes, I would define a frequency vector which spans between -fn/2 and b/2[/b].

In the end, by using a frequency vector such as the one mentioned above, for each simulation I would get two time series: one due to the real components and one due to the imaginary component.

But, generally and especially in our case, we can take advantage of this FFT feature, defining only half of the frequency vector: in the end, imaginary and real part of the FFT will be merged and retrieve our desired 4096 sample time series (for each of the grid point of course).

It seems to me that TurbSim makes use of such a procedure; my question concerns therefore the definition of the frequency range: how shall I define it properly? At the moment I would do this:

`` f = (0:2048)*0.00167;  ``

But this vector contains 2049 elements and when merging real and imaginary part, the zero order is counted twice.

Would you mind to give me a hunch?

I warmly thank you in advance and look forward to hearing from you.

Best regards,
Francesco Perrone

Dear Francesco,

Actually, the Nyquist frequency (cut-off frequency) is 1/2 the sampling rate. In your example:

fn = Nx/(2*T) = 3.41333 Hz

And when defining the discrete Fourier transform (DFT) of the time series, it is customary to write the frequencies from -fn+df to fn.

If the time series is real-valued, you are correct that the discrete Fourier transform (DFT) will be such that frequencies with negative value are the complex conjugates of the frequencies with positive value, so, only the frequencies with positive value are unique and need to be stored. The frequency range you’ve specified (f = (0:2048)*0.00167) is correct (this is how it is defined in FAST’s HydroDyn module) because in your example there are 2047 negative-valued frequencies, from -fn+df to -df.

I hope that helps.

Best regards,

Dear Jason,

I really thank you for the prompt reaction and response.

I’m questioning not that much on the definition of the frequency array itself, but more about its relation to the FFT operation.

Assuming that I define my frequency as follows (only half out of 4096 samples):

f = (1:2048)*0.00167;

Hence, f spans between 0.00167 Hz and 3.413 Hz, as you correctly pointed out.

This way, I do have 2048 FFT orders, and the 0-th order (constant term allowing for the mean wind speed superimposition) is missing.

Now, assuming that my FFT series are only on the real axis of the Gauss plane, I can pad each time series with the supplementary 2048 imaginary conjugate components, reaching the desired 4096 samples. Then I feed this to the FFT, which retrieves the desired time series in the time domain.

My question is: how can I account for the 0-th order component? Well, padding with the imaginary complex gives back the 4096 samples but they are distributed as follows:

-2048, -2047,…,-1,1,…,2047,2048 → 4096.

I hope I explained everything in a comprehensible way.

Any support would be more than appreciated.

Best regards from Germany,
Francesco

Dear Francesco,

As I said in my prior post, when defining the discrete Fourier transform (DFT) of a real time series, it is customary to write the frequencies from -fn+df to fn. Notice that the lowest frequency is -fn+df and not -fn. In terms of the indices of your example, this would be from -2047, -2046, …, -1, 0, 1, …, 2046, 2047, 2048 for a total of 4096 steps. Because there is no -fn to balance with +fn, in HydroDyn we set the DFT associated with fn (index 2048) to zero.

I hope that helps.

Best regards,