📄 fft.c
字号:
#include "filter.h"
#include "stdio.h"
#include "math.h"
#include "complex.h"
#define N 512;
fract16 output[512];//库函数各参数的全局变量定义
complex_fract16 t[512];
complex_fract16 out[512];
complex_fract16 w[512];
fract16 input_data[512]={ //初始化输入数据
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497,3290,-462,5323,-5597,5323,-8595,3290,-18957,
0,18957,-3290,8595,-5323,5597,-5323,462,-3290,-15497,
0,15497};
void main() {
int wst=1;
int n=512;
int block_exponent;
int cale_method=2;// dynamic
twidfftrad2_fr16(w,n);
rfft_fr16(input_data,t,out, w, wst, n, &block_exponent, cale_method);
int i;
for(i=0;i<512;i++)
{
output[i]=cabs_fr16(out[i]);//求变换后的模
printf("%d\t\t",(int)output[i]);
if(i%8==7)
printf("\n");
}
}
//Program End.=======
//库函数的算法说明在“库函数.txt"文件中。
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -