func13.m
资源名称:数值分析课程设计.zip [点击查看]
上传用户:zhdd911129
上传日期:2007-05-11
资源大小:722k
文件大小:0k
源码类别:
matlab例程
开发平台:
Matlab
- %func13
- %polynomial Fitting,the residue analysis willbe show at the end
- x=linspace(1,8,8)
- y=[15.3,20.5,27.4,36.6,49.1,65.6,87.8,117.6];
- y = log(y);
- [p,S] = polyfit(x,y,1)
- f = polyval(p,x);
- y=exp(y)
- f=exp(f)
- plot(x,y,'o',x,f,'-')
- disp(abs(norm(y,inf)-norm(f,inf)))
- %b=0.29121601623819 a=2.43685970632819
- %the residure is (defined by infinite norm on those vector) :0.0824
- %can also see the figure