附录一:C 语言主函数程序
#include "stdio.h"
#include "time.h"
int con_buf=0;
int htime=0;
clock_t start,stop,substraction;
int a_in;
int temp1;
int temp2;
int beta=0;
float input0=0.3;
float input1=0;
short int x;
int x_temp;
int flag1=0;
int flag2=0;
int flag=0;
int q=0;
//const float a0=0.6666;
short int a0=21845; //q15
//const float a1=0.35416;
short const int a1=11605; //q15
//const int a2=1.314;
short const int a2=21528; //q14
//const int a3=0.763;
short const int a3=25001; //q15
//const int a4=1.5688;
short const int a4=25703; //q14
int a_out1=0;
int a_out2=0;
int temp=0;
float output=0;
main()
{
start=clock();
input1=input0;
while(input1>1)
{ input1=input1/4;
flag1+=1;
}
while(input1<0.25)
{ input1=input1*4;
flag2+=1;
}
x=(int)(input1*32768); //q15
// x_temp=(int)(input1*16384);//q14
// a_in=a0*x+a1;
temp=a0*x; //q30
// a_in=a0*x+a1;
//// +a1
a_in=(temp>>15)+a1; //q15
////// +a1
// beta=0.763*x*x-1.5688*x+1.314;
//// 0.763*x*x
temp=x*x; //q30