基于最小二乘法的C++二次抛物线拟合

//
//a0x^2+a1x+a2 = y
//r:相关系数^2
bool Parabola(double* x, double* y, int n, double* a, double* r)
{
	const int CURVE_INDEX = 3;
	double B[CURVE_INDEX];
	double **A =new double*[CURVE_INDEX];
	for (int i=0; i EPSILONG && fabs(sumY2) > EPSILONG)
	{
		*r = (sumYNY2*sumYNY2)/(sumNY2*sumY2);
	}
	delete []ny;

	return solved;
}

 

你可能感兴趣的:(技术)