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

📄 fouriertransform.cpp

📁 这是一个非常经典的FourierTransform 算法比较有新意
💻 CPP
字号:
// FourierTransform.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "FastFourier.h"

Complex E(double x, int k)
{
	return Complex(cos(k*x), sin(k*x));
}

//教材中P362的函数f
Complex f(double x)
{
	Complex sum(0, 0);
	for(int i = 0; i < 8; i++)
		sum += (i+1)*E(x, i);

	return sum;
}

int main(int argc, char* argv[])
{
	int m = 3;
	int N = (int)pow(2, m);
	Complex *C = new Complex[N];

	FastFourierTransform(m, f, C);

	for(int i = 0; i < 8; i++)
		cout << C[i] << endl;
	
	return 0;
}


⌨️ 快捷键说明

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