fft.cpp

来自「fft算法」· C++ 代码 · 共 63 行

CPP
63
字号
// fft.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include "fft.h"

int _tmain(int argc, _TCHAR* argv[])
{
/*
//for testing the part of complex
	complex a = {1,2},b = {-2,1},c;
	printf("\n");
	printf("%f\n",c_mode(c));
	printc(c);
	printf("\n");
	c = c_multiply(a,b);
*/
/*
//for testing the part of W factor by generating a 16-points W factors
	complex *w;
	w = w_factor(16);
	for(int i=0;i<8;i++)
	{
		printc(w[i]);
		printf("\n");
	}
*/
/*
//for testing the function invert()
	int i;
	for(i=1;i<=7;i++)
		printf("%d%s%d\n",i,"  ",invert(i,3));
*/
/*
//for testing the function wash()
	int i;
	double *p,time[16] = {0.382683,0.707107,0.923880,1.000000,
					[	0.923880,0.707107,0.382683,0.000000,
						-0.38268,-0.707107,-0.923880,-1.000000,
						-0.923880,-0.707107,-0.382683,-0.000000};
	wash(time,16,4);
	for(i=0;i<16;i++)
	{
		printf("%d%s%f\n",i," ",time[i]);
	}
*/
	double time[16] = {0.382683,0.707107,0.923880,1.000000,
						0.923880,0.707107,0.382683,0.000000,
						-0.38268,-0.707107,-0.923880,-1.000000,
						-0.923880,-0.707107,-0.382683,-0.000000};
	complex *c_fre;
	double fre[16];
	c_fre = r2_fft(time,16);
	for(int i=0;i<16;i++)
	{
		fre[i] = c_mode(c_fre[i]);
		printf("%f",fre[i]);
		printf("\n");
	}
	return 0;
}

⌨️ 快捷键说明

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