24小时热门版块排行榜    

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

m452193160

新虫 (小有名气)

[求助] 数据拟合求助 已有2人参与

x=1:6;
y=[0.105935612        0.042331078        0.024863921        0.028627497        0.033000851        0.063137188];
f=inline('a(1)./(a(2)+x)-a(3)./(a(4)+x)+a(5)','a','x');
[a,res]=lsqcurvefit(f,[1,1,1,1,1],x,y);


为什么matlab一直错误。。。求助。。。

发自小木虫Android客户端
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

luoshengfeng

木虫 (正式写手)

【答案】应助回帖

感谢参与,应助指数 +1
我这里是可以的 (matlab2013a) 以下是结果
>> x=1:6;
>> y=[0.105935612        0.042331078        0.024863921        0.028627497        0.033000851        0.063137188];
>> f=inline('a(1)./(a(2)+x)-a(3)./(a(4)+x)+a(5)','a','x');
>> [a,res]=lsqcurvefit(f,[1,1,1,1,1],x,y)

Local minimum possible.

lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the default value of the function tolerance.

<stopping criteria details>


a =

    0.6771    0.8328    0.6623    1.1782    0.0258


res =

    0.0018

>>

» 本帖已获得的红花(最新10朵)

知行合一
3楼2016-12-29 08:33:42
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 m452193160 的主题更新
信息提示
请填处理意见