样条函数拟合

样条函数拟合

ID:41485230

大小:75.11 KB

页数:8页

时间:2019-08-25

样条函数拟合_第1页
样条函数拟合_第2页
样条函数拟合_第3页
样条函数拟合_第4页
样条函数拟合_第5页
资源描述:

《样条函数拟合》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、样条函数拟合方法样条函数拟合是将复杂曲线分为多段,段内用3次多项式进行拟合,同时保证分段的左右短连续且一、二次可导,以保证连接处的光滑。PublicFunctionFitBySpline(ByValX()AsSingle,ByVaiY()AsSingle,ByVaiSectorlndexs()AsInteger)AsArray,按照X点生成拟合后Y坐标'Sectorindex段索引,Sectorlndexs段端所指的点索引DimYl(UBound(X))AsSingle,iAsInteger,Sectorind

2、exAsInteger,XLKAsSingle,ConfAsArrayConf=FitBySpline(X,Y,Sectorlndexs),拟合出曲线系数Fori=0ToUBound(X)Sectorindex=SearchSectorIndex(SearchIndex(X(i),X),Sectorlndexs)XLK=2*(X(i)-X(SectorIndexs(SectorIndex)))/(X(SectorIndexs(SectorIndex+1))-X(SectorIndexs(SectorIndex)

3、))一1Yl(i)=Conf(7*Sectorindex+0)+Conf(7*Sectorindex+1)*XLK+Conf(7*Sectorindex+2)*(2*XLK人2・1)+Conf(7*Sectorindex+3)*(4*XLK人3・3*XLK)NextReturnY1EndFunctionPrivateFunctionSearchSectorIndex(ByValIndexAsInteger,ByVaiSectorlndexs()AsInteger)AsIntegerDimiAsIntegerFo

4、ri=OToUBound(Sectorlndexs)・1IfIndex>=Sectorlndexs(i)AndIndex<=Sectorlndexs(i+1)ThenReturniEndIfIfIndex>=Sectorlndexs(i)AndSectorlndexs(i+1)=0Then。环狀ReturniEndIfNextEndFunctionPrivateFunctionSearchIndex(ByValXIAsSingle,ByVaiX()AsSingle)AsIntegerDimiAsIntegerF

5、ori=0ToUBound(X)IfXl>=X(i)AndXI<=X(i+1)ThenReturniEndIfNextEndFunction'样条函数拟合计算,返冋样条函数系数'x-x序列y-序列'Sectorlndexs-分段点索引序列'技术要求:双端在X的分段,X0和Xn是分段的首末点PrivateFunctionFitBySpline(ByValX()AsSingle,ByVaiY()AsSingle,ByVaiSectorlndexs()AsInteger)AsArrayDimSectorCount=U

6、Bound(Sectorlndexs)'M个点将差出M-l段DimTotalRowAsInteger=(SectorCount)*7-3DimMatrixA(TotalRow-1,TotalRow-1),MatrixB(TotalRow-1)AsSingleDimCurrentSectorlndex,CurrentPointlndex,CurrentPointlndexPerSectorAsIntegerDimHl,XLKAsSingle,PointCountPerSectorAsIntegerDimAl,A2

7、,A3,A4AsSingleForCurrentSectorlndex=0ToSectorCount-1Hl=1/(X(Sectorlndexs(CurrentSectorIndex+1))・X(SectorIndexs(CurrentSectorIndex)))PointCountPerSector=SectorIndexs(CurrentSectorIndex+1)-Sectorlndexs(CurrentSectorlndex)'双端在X上,仅计入一个ForCurrentPointlndexPerSect

8、or=0ToPointCountPerSector-1CurrentPointlndex=CurrentPointlndexPerSector+Sectorlndexs(CurrentSectorlndex)XLK=2*(X(CurrentPointlndex)-X(SectorIndexs(CurrentSectorIndex)))*Hl-1Al=1A2=XLKA3=2*XLK八2・

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。