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

📄 fft.h

📁 3D游戏编程领域的老手撰写的启迪性文章之一
💻 H
字号:
#include <iostream.h>
#include <math.h>
#include <complex.h>

void FFT(float *X, float *Y)
{
   int k, n;						// integers for the loops
   complex mult;					// a complex number
   float prod;						// a floating point number for the real component
   complex i=complex(0, 1);	// the square root of -1

	for(k=0; k<512; k++)				// loops through each sub harmonic
   {
		for(n=0; n<1024; n++)		// loops through each sample
      {
      	mult=exp((-2*M_PI*i*k*(n+1))/1024);	// calculates the equation
         prod=real(mult);							// gets the real component
         Y[k]=+X[n]*prod;							// multiplies the real component
      }
   }
}

⌨️ 快捷键说明

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