实数数组经傅里叶变换后的空间频率域是什么样的?

huangapple go评论64阅读模式
英文:

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

问题

我有一个包含N个纯实数点的数组,代表一个空间函数:

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

这些函数值之间的间距是dx。

因此,奈奎斯特频率由f_N = 1/(2*dx)给出。

我使用C中的FFTW2计算数组的傅里叶变换,使用纯1D实数输入rfftw函数。这导致只有N/2个独立的复数,它们存储在一个"半复数数组"中:

[r_0, r_1, .... r_{N/2}, i_{N+1}/2-1 , ..., i_2, i_1],
其中r表示实部,i表示虚部。

现在我想知道这个数组的频域是什么样的。
r_{N/2}是在f_N处的值还是(f_N/)2?

我已经有了代码,它似乎可以工作,我只是不知道如何解释频率轴。

英文:

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

得分: 2

你的表示方式有些混淆。如果你的输入是

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

那么 f_n 是位置 n 处的输入值,而不是一个位置本身。输入位于整数索引 n = 0 … N-1 处。因此,关于“f_N 处的值”这个问题是没有意义的。

FFTW 半复数输出为:

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

在这里,r_n + i * i_n 是位置 n 处的值。频率是整数索引 n = 0 … N-1。奈奎斯特频率与 N 有关,而不是 f_N(在你的输入中甚至没有定义!)。它由 N/2.0 给出。

如果你假设在你的输入中有一个特定的采样间隔 dx,使得在位置 n 处的样本具有 x = n*dx,那么你还可以将频率分箱转换为物理频率,其中 df = 1/(N*dx)。因此,索引 n 处的频率为 n/(N*dx)。要理解的是,频率 n/(N*dx) 的值等于 (n+k*N)/(N*dx) 处的值,其中 k 可以是任何正整数或负整数(从中你可以获得许多人期望在傅立叶变换中找到的负频率)。

英文:

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).

huangapple
  • 本文由 发表于 2023年7月4日 21:43:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76613265.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定