24小时热门版块排行榜    

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

chj787

金虫 (小有名气)

[求助] matlab拟合求助

用matlab拟合一个方程:
    y=(a+bx+cx^2+dx^3)exp(-bx)
x=[0.8,0.85,0.9,0.94,1,1.1,1.14,1.144,1.146,1.148,1.149,1.15,1.151,1.152,1.153,1.157,1.25,1.3,1.35,1.4,1.45,1.5,1.55,1.6,1.65,1.7,1.75,1.8,1.85,1.9,1.95,2,2.05,2.1,2.15,2.2,2.25,2.3,2.35,2.4];
y=[129698.6607,81517.14907,48462.38869,30160.54842,12625.39888,830.7904906,0,2.343989057,8.695584894,18.42928479,24.54823752,31.4946096,39.26181681,47.84108015,57.22581538,102.7141275,687.9234793,3872.493796,7589.20011,11578.99871,15654.88623,19681.73873,23751.25051,27388.0944,30756.13673,33816.1486,36542.19252,38921.37873,40955.22819,42660.53072,44067.23581,45213.10408,46138.07991,46880.36067,47474.18002,47948.97387,48329.25318,48634.92208,48881.88591,49082.65691];

变量:x,y
拟合常数: a,b,c,d
求高手帮助!给出matlab拟合程序。

[ Last edited by chj787 on 2012-5-20 at 16:29 ]
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

lgycjpcqu

金虫 (正式写手)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
xzhdty: 金币+1, 谢谢了 2012-05-22 06:01:48
chj787: 金币+15, ★★★★★最佳答案, 非常感谢!评分晚了,万分抱歉~! 2012-05-29 15:29:20
x=[0.8,0.85,0.9,0.94,1,1.1,1.14,1.144,1.146,1.148,1.149,1.15,1.151,1.152,1.153,1.157,1.25,1.3,1.35,1.4,1.45,1.5,1.55,1.6,1.65,1.7,1.75,1.8,1.85,1.9,1.95,2,2.05,2.1,2.15,2.2,2.25,2.3,2.35,2.4];
y=[129698.6607,81517.14907,48462.38869,30160.54842,12625.39888,830.7904906,0,2.343989057,8.695584894,18.42928479,24.54823752,31.4946096,39.26181681,47.84108015,57.22581538,102.7141275,687.9234793,3872.493796,7589.20011,11578.99871,15654.88623,19681.73873,23751.25051,27388.0944,30756.13673,33816.1486,36542.19252,38921.37873,40955.22819,42660.53072,44067.23581,45213.10408,46138.07991,46880.36067,47474.18002,47948.97387,48329.25318,48634.92208,48881.88591,49082.65691];
ybeta=inline('(beta(1)+beta(2)*x+beta(3)*x.^2+beta(4)*x.^3).*exp(-beta(2)*x)','beta','x');
beta=nlinfit(x,y,ybeta,[1e+004,0,-1e+004,1e+004]);
a=beta(1);
b=beta(2);
c=beta(3);
d=beta(4);
yy=(a+b*x+c*x.^2+d*x.^3).*exp(-b*x);
plot(x,yy,x,y,'*')
但是会显示
Warning: The Jacobian at the solution is ill-conditioned, and some
model parameters may not be estimated well (they are not identifiable).
Use caution in making predictions.所以可能还需要进一步手动优化,我做你何时用nlinfit也经常出现这个警告,期待有高手解答。
拟合结果是
3866678.20479525       
2.55862906421524       
-8281766.51676900       
4642226.52606192
希望能帮到你
7楼2012-05-21 10:31:55
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 chj787 的主题更新
信息提示
请填处理意见