资源描述:
《实验二次多项式最小二乘拟合.docx》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验二次多项式最小二乘拟合一、实验目的编制以离散点的正交多项式为基的最小二乘拟合程序,并用于对下列数据做次多项式最小二乘拟合.取权求出拟合曲线,输出,(系数),,的值及平方误差,画出的图形,并描出插值点及分别用‘o’和‘*’标记.二、实验原理设已知y=f(x)的观测数据为nk=1nxkk=1nxkk=1nxk2k=1nxk2…k=1nxkmk=1nxk2…k=1nxkm+1⋮⋮k=1nxkmk=1nxkm+1⋮⋮k=1nxkm+1…k=1nxk2ma0a1⋮an=k=1nykk=1nxkyk⋮k=1nxkmyk解此方程组求
2、出akk=0,1,…,m的值,即可求得近似函数φx。三、实验结果所用数据:x=[-2.9405,-2.6003,-2.2462,-1.7332,-1.4674,-0.8610,0.0101,0.3605,0.5078,1.0798,1.3923,1.7162,2.9099];y=[-1.2430,-1.2037,-1.1519,-1.0475,-0.9726,-0.7108,0.0101,0.3460,0.4698,0.8237,0.9479,1.0432,1.2398];ds1=0.1037,dsn=0.1056;(第一
3、种边界条件)t=[-2.9405,-2.2905,-1.6404,-0.9904,-0.3403,0.3097,0.9598,1.6098,2.2599,2.9099];(指定计算点)用{1,x,x^2,...x^n}拟合的结果:平方误差:0.32698参数:-2.8033e-0050.87923-1.75840.75007用正交多项式拟合的结果:平方误差:0.30798参数:-2.8033e-0050.90839-1.81670.75964三项递推公式的系数为:b=00.39820.2737a=111c=0.21300.
4、00000.9083-0.0000用{1,x,x^2,...x^n}拟合的结果:平方误差:0.32698参数:-2.8033e-0050.87923-1.75840.75007用正交多项式拟合的结果:平方误差:0.30798参数:-2.8033e-0050.90839-1.81670.75964三项递推公式的系数为:b=00.39820.2737a=111c=0.21300.00000.9083-0.0000