中科因仑“3+1”工程特种兵精英论坛
标题:
MSP430 FFT算法
[打印本页]
作者:
张衍波
时间:
2015-3-10 13:57
标题:
MSP430 FFT算法
/*****************main programe********************/
#include <msp430x14x.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "typedef.h "
float result[8];
struct compx s[8];
int Num=8;
const float pp=3.141592653589793;
extern void FFT(struct compx *s,int num);
double mpr[8],mpi[8],mfr[8],mfi[8];
int n,k,l,il;
extern void kbfft();
extern void FFT_dingdian();
main()
{
// ????
int i;
FILE *fin,*fout;
if((fin=fopen( "indata.txt ", "r "))==NULL)
{
printf( "can 't open infile ");
exit(0);
};
for(i=0;i <Num;i++)
{
//fscanf(fin, "%lf ",&s.real);
s.real=cos(2*3.1415926*(30)*(i)/80.0);//
s.imag=(double)0;
mpr=s.real;
mpi=0;
};
fclose(fin);
//////////////
//FFT(s,Num);
//n=8;k=3;l=0;il=0;
//kbfft(mpr,mpi,n,k,mfr,mfi,l,il);
FFT_dingdian();
//????
if((fout=fopen( "fftresult.txt ", "w "))==NULL)
{
printf( "can 't open outfile ");
exit(0);
};
for(i=0;i <Num;i++)
{
// result=sqrt(pow(s.real,2)+pow(s.imag,2));
fprintf(fout, "%lf+(%lf)i ",s.real,s.imag);
};
fclose(fout);
}
欢迎光临 中科因仑“3+1”工程特种兵精英论坛 (http://bbs.enlern.com/)
Powered by Discuz! X3.4