用lsqcurvefit没能拟合出参数,求各位指教。代码如下。
3 views (last 30 days)
Show older comments
function f=XU(x,data)
XOD=data(1,:);
UA=data(2,:);
f=x(1)*(1+(x(2)*XOD)./(XOD+x(3)))-x(4)*UA
clc;
XOD=[13.920855 16.137478 18.802967 21.793845 19.668576 22.731821 23.275489 28.416212 30.66387];
UA=[34.723876 114.1186 91.402479 79.854949 77.639966 92.321463 104.54 96.047456 106.25276];
ydata=[10.4299978000000,-1.45032320000000,-0.425708066666667,0.0532981666666667,-0.00421063333333341,0.138016733333333,-0.0427233666666666,-0.0627239250000000,-0.0827244833333334];
data=[XOD;UA];
option=optimset('MaxFunEvals',50000000);
x0=[0.5 0.5 0.1 1];
[a,resnorm]=lsqcurvefit(@XU,x0,data,ydata,[0 0 0 0],[],option);
出现在命令栏中的提示如下:
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>
0 Comments
Accepted Answer
bipeh
on 23 Nov 2022
如果要求都大于0,加一句:ParameterDomain = [0,];
均方差(RMSE):1.50695589848579
残差平方和(SSE):20.43824471983
相关系数(R): 0.895278856473547
相关系数之平方(R^2): 0.801524230848583
确定系数(DC): 0.801524230848583
卡方系数(Chi-Square): 9.45032996543549
F统计(F-Statistic): 8.39733068571794
参数 最佳估算
---------- -------------
x1 1.89870321365435
x2 5.89251645596632
x3 3.8799368609697E-15
x4 0.137066729882979
0 Comments
More Answers (0)
See Also
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!