unsigned char zxechf(double x[],double y[],unsigned char n,double *a,double *b)
{
double A=0.0,B=0.0,C=0.0,D=0.0,delta;
unsigned char i;
for(i=0;i<n;i++)
{
A+=x*x;
B+=x;
C+=x*y;
D+=y;
}
delta = A*n-B*B;
if((delta>-0.000001)&&(delta<0.000001))
{
return 1;
}
*a=(A*n-B*B)/delta;
*b=(A-C)*D/delta;
return 0;
}
文章评论(0条评论)
登录后参与讨论