【发布时间】:2017-01-21 12:22:55
【问题描述】:
在 C++ 中并使用 FFTW 的这个 MATLAB 行代码的确切等价物是什么?
fftshift(fft(x,4096)));
注意:X 是一个包含 4096 个双精度数据的数组。
现在我在 c++ 和 FFTW 中使用这些代码行来计算 fft
int n = 4096
fftw_complex *x;
fftw_complex *y;
x = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * n);
y = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * n);
for (int i=0; i<n; i++)
{
x[i][REAL] = MyDoubleData[i];
x[i][IMAG] = 0;
}
fftw_plan plan = fftw_plan_dft_1d(n, x, y, FFTW_FORWARD, FFTW_ESTIMATE);
fftw_execute(plan);
fftw_destroy_plan(plan);
fftw_cleanup();
它相当于 MATLAB 中的 FFT 函数。 FFTW 库中是否有与 FftShift 等效的函数?
【问题讨论】: