Skip to content
Snippets Groups Projects
Commit 2b4580fa authored by Yuto Makino's avatar Yuto Makino
Browse files

新規ファイルをアップロード

parent 0edfd0b1
Branches
No related tags found
No related merge requests found
#include <stdio.h>
#include <complex.h>
#include <fftw3.h>
#define N 512 // FFTのサンプル数
int main( void ){
int i;
fftw_complex *a, *b;
a = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
b = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
fftw_plan plan;
plan = fftw_plan_dft_1d(N, a, b, FFTW_FORWARD, FFTW_ESTIMATE );
for (i = 0; i < N; i++) {
a[i] = i + 0.0 * I;
}
// フーリエ変換実行 b[n]に計算結果が入る
fftw_execute(plan);
fftw_plan plan;
plan = fftw_plan_dft_1d(N, a, b, FFTW_FORWARD, FFTW_ESTIMATE );
for (i = 0; i < N; i++) {
a[i] = i + 0.0 * I;
}
// フーリエ変換実行 b[n]に計算結果が入る
fftw_execute(plan);
for( i=0; i<N; i++){
// printf("FFT[%d] = (%f, %f)\n", i, creal(b[n]), cimag(b[n]));
}
fftw_destroy_plan(plan);
fftw_free(a);
fftw_free(b);
return 0;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment