What does the spatial frequency domain look like after the Fourier transform of a real array?

82 Views Asked by At

I have an array with N purely real points representing a spatial function:

[f_0, f_1, f_2, ... , f_{N-1}]

The function values are spaced in with a distance dx.

Therefore the Nyquist frequency is given by f_N = 1/(2*dx)

I calculate the Fourier transform of the array in C using FFTW2, with the function for purely 1d real inputs rfftw. This leads to only N/2 independent complex numbers, which are stored in a "half complex array":

[r_0, r_1, .... r_{N/2}, i_{N+1}/2-1 , ..., i_2, i_1], where r denotes the real and i the imaginary part.

Now I would like to know what the frequency domain of this array looks like. Is r_{N/2} the value at f_N or (f_N/)2?

I already have the code and it seems to work, i just don't know how to interpret the frequency axis.

1

There are 1 best solutions below

3
On

Your notation is confused. If your input is

[f_0, f_1, f_2, …, f_{N-1}]

then f_n is the input value at position n, it is not a position itself. The inputs are at integer indices n = 0 … N-1. Thus the question asking about “the value at f_N” makes no sense.

The FFTW half-complex output is:

[r_0, r_1, r_2, …, r_{N/2}, i_{(n+1)/2-1}, …, i_2, i_1]

Here, r_n + i * i_n is the value at position n. Frequencies are the integer indices n = 0 … N-1. The Nyquist frequency is related to N, not f_N (which is not even defined in your input!). It is given by N/2.0.

If you assume a certain sampling dx in your input, such that the sample at position n has a x = n*dx, then you can also translate frequency bins to physical frequencies, with df = 1/(N*dx). Thus, the frequency at index n is n/(N*dx). With the understanding that the value for frequency n/(N*dx) is equal to that for (n+k*N)/(N*dx), with k any positive or negative integer (from which you can obtain the negative frequencies that many expect to find in a Fourier transform).