matlab插值曲线拟合.pptVIP

  • 23
  • 0
  • 约9.49千字
  • 约 56页
  • 2016-01-09 发布于湖北
  • 举报
matlab插值曲线拟合.ppt

a = polyfit(xdata,ydata,n) 其中n表示多项式的最高阶数 xdata,ydata 为要拟合的数据,它是用向量的方式输入。 输出参数a为拟合多项式 y = a1xn + … + anx + an+1的系数a = [a1, …, an, an+1]。 多项式在x处的值y可用下面程序计算。 y = polyval (a, x) 例a 已知观测数据点如表所示 x y 0 -0.447 0.1 1.978 0.2 3.28 0.3 6.16 0.4 7.08 0.5 7.34 0.6 7.66 0.7 9.56 0.8 9.48 0.9 9.3 1 11.2 分别用3次和6次多项式曲线拟合这些数据点. x=0:0.1:1 y=[-0.447,1.978,3.28,6.16,7.08,7.34,7.66,9.56,9.48,9.3,11.2] plot(x,y,k.,markersize,25) axis([0 1.3 -2 16]) p3=polyfit(x,y,3) p6=polyfit(x,y,6) 编写Matlab程序如下: t=0:0.1:1.2 s=polyval(p3,t) s1=polyval(p6,t) hold on plot(t,s,r-,linewidth,2) plot(t,s,b--,linewidth,2) grid x=0:0.1

文档评论(0)

1亿VIP精品文档

相关文档