.h文件
/*
vecPointX n个节点x坐标
vecPointY n个节点y坐标
dDy1 函数在x0处的二阶导数值
dDy2 函数在xn-1处的二阶导数值
iPointSizeN 节点个数 至少为3
vecInputX 需要差值计算的节点
vecCalResultY 差值计算的结果
*/
bool Spline3(std::vector<double> &vecPointX,std::vector<double> &vecPointY,double dDy1,double dDy2,int iPointSizeN,std::vector<double> &vecInputX,std::vector<double> &vecCalResultY);
.cpp 文件
bool Spline3(std::vector<double> &vecPointX,std::vector<double> &vecPointY,double dDy1,double dDy2,int iPointSizeN,std::vector<double> &vecInputX,std::vector<double> &vecCalResultY)
{
std::vector<double> vecDy(iPointSizeN,0);
std::vector<double> vecA(iPointSizeN,0);
std::vector<double> vecB(iPointSizeN,0);
double dH1 = vecPointX[1]- vecPointX[0];
vecA[0] = -0.5;
vecB[0] = 3.0*(vecPointY[1] - vecPointY[0])/(2*dH1) - dDy1*dH1/4.0;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余4页未读,立即下载