最小二乘法拟合的问题。
Show older comments
用MATLAB软件进行计算.
1)编写函数M-文件 nongdu.m
function f = nongdu(x,tdata)
f = x(1)+x(2)*exp(-0.02*x(3)*tdata);
其中 x(1) = a;x(2) = b;x(3) = k;
2) 在工作空间中执行以下命令(test1.m)
tdata = linspace(100,1000,10);
cdata =[4.54 4.99 5.35 5.65 5.90 6.10 ...
6.26 6.39 6.50 6.59];
x0 = [0.2,0.05,0.05];
x=lsqcurvefit (‘nongdu’,x0,tdata,cdata)
3) 输出结果: x = 0.007 -0.003 0.1012
即 k = 0.1012, a = 0.007, b = -0.003,
为啥我得到的结果是:x = -85.9771 90.3988 -0.0014
并提示
Solver stopped prematurely.
lsqcurvefit stopped because it exceeded the function evaluation limit,
options.MaxFunEvals = 300 (the default value).
该如何解决?谢谢
Accepted Answer
More Answers (0)
Categories
Find more on 数学 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!