作业帮 > 综合 > 作业

急求matlab程序 二次拟合 曲线的方程

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/04/28 04:42:20
急求matlab程序 二次拟合 曲线的方程
x=[1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009];
y=[5156 5138 6526 7434 8475 9688 10703 11384 12343 13630 15558 18472 19820];
求求二次拟合 曲线的方程 matlab程序
x=[1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009];y=[5156 5138 6526 7434 8475 9688 10703 11384 12343 13630 15558 18472 19820];
>> p=polyfit(x,y,2)
Warning:Polynomial is badly conditioned.Add points with distinct X
values,reduce the degree of the polynomial,or try centering
and scaling as described in HELP POLYFIT.
> In polyfit at 80
p =
1.0e+008 *
0.0000 -0.0023 2.3021
可见,你提供的数据不适合二次多项式拟合,
>> p=polyfit(x,y,1)
p =
1.0e+006 *
0.0012 -2.3969
可得直线关系:y=1200*x-2396900