小编Har*_*der的帖子

使用 FFTW_MEASURE 时 FFT 输出为空,但使用 FFTW_ESTIMATE 时工作正常

我在尝试使用 fftw3 时遇到以下问题。由于某种原因,每当我使用 FFTW_MEASURE 而不是 FFTW_ESTIMATE 进行 FFT 时,我都会得到空白输出。最终我试图实现 fft 卷积,因此下面的示例包括 FFT 和逆 FFT。

显然我错过了一些东西......有人能教育我吗?谢谢你!

我使用的是 Linux (OpenSUSE Leap 42.1),使用包管理器中提供的 fftw3 版本。

最小工作示例:

#include <iostream>
#include <iomanip>
#include <cmath>
#include <fftw3.h>
using namespace std;


int main(int argc, char ** argv)
{
    int width = 10;    
    int height = 8;

    cout.setf(ios::fixed|ios::showpoint);
    cout << setprecision(2);

    double * inp = (double *) fftw_malloc(sizeof(double) * width * height);
    fftw_complex * cplx = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * height * (width/2 + 1));

    for(int i = 0; …
Run Code Online (Sandbox Code Playgroud)

c++ fftw

6
推荐指数
1
解决办法
1108
查看次数

标签 统计

c++ ×1

fftw ×1