func14.m
上传用户:zhdd911129
上传日期:2007-05-11
资源大小:722k
文件大小:0k
源码类别:

matlab例程

开发平台:

Matlab

  1. %func14.m
  2. %polynomial Fitting,the residue analysis willbe show at the end
  3. %曲线拟合均调用了matlab的函数
  4. x=linspace(-1,1,9)
  5. y=[-0.2209,0.3295,0.8826,1.4392,2.0003,2.5645,3.1334,3.8061,4.2836];
  6. [p,S] = polyfit(x,y,3)
  7. f = polyval(p,x);
  8. plot(x,y,'o',x,f,'-')
  9. disp(abs(norm(y,inf)-norm(f,inf)))
  10. %p=-0.03562558922559*x^3+0.04342683982684*x^2+2.29792053872054*x+2.00616103896104
  11. %the residure is (defined by infinite norm on those vector) : 0.0283
  12. %can also see the figure