⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fftreal.c

📁 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without ev
💻 C
字号:
#include <stdio.h>#include <math.h>#include <gsl/gsl_errno.h>#include <gsl/gsl_fft_real.h>#include <gsl/gsl_fft_halfcomplex.h>intmain (void){  int i, n = 100;  double data[n];  gsl_fft_real_wavetable * real;  gsl_fft_halfcomplex_wavetable * hc;  gsl_fft_real_workspace * work;  for (i = 0; i < n; i++)    {      data[i] = 0.0;    }  for (i = n / 3; i < 2 * n / 3; i++)    {      data[i] = 1.0;    }  for (i = 0; i < n; i++)    {      printf ("%d: %e\n", i, data[i]);    }  printf ("\n");  work = gsl_fft_real_workspace_alloc (n);  real = gsl_fft_real_wavetable_alloc (n);  gsl_fft_real_transform (data, 1, n,                           real, work);  gsl_fft_real_wavetable_free (real);  for (i = 11; i < n; i++)    {      data[i] = 0;    }  hc = gsl_fft_halfcomplex_wavetable_alloc (n);  gsl_fft_halfcomplex_inverse (data, 1, n,                                hc, work);  gsl_fft_halfcomplex_wavetable_free (hc);  for (i = 0; i < n; i++)    {      printf ("%d: %e\n", i, data[i]);    }  gsl_fft_real_workspace_free (work);  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -