24小时热门版块排行榜    

查看: 1191  |  回复: 7
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

miracleyin

金虫 (小有名气)

[求助] matlab曲线拟合的一个小问题

我的程序如下:
x=[ 20  30  40  50  60  70  80  90 100];
y=[347 404 420 429 436 455 486 502 436];
[p,s] = polyfit(x,y,8)
xi=linspace(x(1),x(end),1000);
f=polyval(p,xi);
plot(x,y,'ko-',xi,f,'-')
k=polyval(p,x);

可得到的结果为:
p =

  1.0e+003 *

   -0.0000    0.0000   -0.0000    0.0000   -0.0000    0.0009   -0.0248    0.3813   -2.1230


s =

        R: [9x9 double]
       df: 0
    normr: 3.3939e-010


实在不理解这其中p怎么是这样的。我要的这八项多项式的系数的。
回复此楼
keepmoving
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

miracleyin(金币+2): 2011-11-26 12:34:53
x=[ 20  30  40  50  60  70  80  90 100];
y=[347 404 420 429 436 455 486 502 436];
[p,s] = polyfit(x,y,8)
fx=poly2sym(p)%这个可以表示成多项式格式
xi=linspace(x(1),x(end),1000);
f=polyval(p,xi);
plot(x,y,'ko-',xi,f,'-')
k=polyval(p,x);

p =

  1.0e+003 *

   -0.0000    0.0000   -0.0000    0.0000   -0.0000    0.0009   -0.0248    0.3813   -2.1230
这个就是八阶多项式系数 一共九项(x---x^8+常数项)
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
2楼2011-11-26 11:34:55
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

表示的就是 1000×
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
4楼2011-11-26 12:18:59
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 miracleyin 的主题更新
信息提示
请填处理意见