ifft.cpp

来自「c++的数学物理方程数值算法源程序。这是"Numerical Methods f」· C++ 代码 · 共 28 行

CPP
28
字号
#include "NumMeth.h"void fft( Matrix& RealA, Matrix& ImagA);void ifft( Matrix& RealA, Matrix& ImagA) {// Routine to compute inverse Fourier transform using FFT algorithm// Inputs//    RealA, ImagA         Real and imaginary parts of transform// Outputs//    RealA, ImagA         Real and imaginary parts of time series  int i, N = RealA.nRow();   // Number of data points

  //* Take complex conjugate of input transform  for( i=1; i<=N; i++ )    ImagA(i) *= -1.0;        // Complex conjugate
  //* Evaluate fast fourier transform    fft( RealA, ImagA );         
  //* Take complex conjugate and normalize by N  double invN = 1.0/N;  for( i=1; i<=N; i++ ) {    RealA(i) *= invN;    ImagA(i) *= -invN;    // Normalize and complex conjugate  }}

⌨️ 快捷键说明

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