func14.m
资源名称:数值分析课程设计.zip [点击查看]
上传用户:zhdd911129
上传日期:2007-05-11
资源大小:722k
文件大小:0k
源码类别:
matlab例程
开发平台:
Matlab
- %func14.m
- %polynomial Fitting,the residue analysis willbe show at the end
- %曲线拟合均调用了matlab的函数
- x=linspace(-1,1,9)
- y=[-0.2209,0.3295,0.8826,1.4392,2.0003,2.5645,3.1334,3.8061,4.2836];
- [p,S] = polyfit(x,y,3)
- f = polyval(p,x);
- plot(x,y,'o',x,f,'-')
- disp(abs(norm(y,inf)-norm(f,inf)))
- %p=-0.03562558922559*x^3+0.04342683982684*x^2+2.29792053872054*x+2.00616103896104
- %the residure is (defined by infinite norm on those vector) : 0.0283
- %can also see the figure