X = ...
[0.1157 5 5.5
0.1233 5 5.57
0.1865 12 5.56
0.2520 12 5.61
0.2519 15 5.53
0.2814 15 5.42
0.3680 18 5.37
0.3186 18 5.56
0.4549 22 5.42
0.4757 25 5.45
0.4559 25 5.49
0.4241 30 5.57
0.4697 30 5.46
0.4953 35 5.50
0.5767 35 5.42
0.4163 40 5.58
0.4279 40 5.53];
y = X(:,1);
T = X(:,2);
pH = X(:,3);
Xdata = [T pH];
Ydata = y;
y = @(param, xdata) param(1).*(xdata(:,1)-param(3)).*(1-exp(param(2).*(xdata(:,1)-param(4)))).*(1-10.^(param(5)-xdata(:,2)));
problem = createOptimProblem('lsqcurvefit','x0',rand(1,5),...
'objective', y, 'xdata', Xdata, 'ydata', Ydata);
ms = MultiStart;
solMs = run(ms,problem,50);
sol_1st_opt = [-5.8541753677852E-13 0.0540580580588969 52.4138416996001 -5.49253844700665 15.2843009735593];
plot3(T, pH, Ydata, 'b+-', ...
T, pH, y(solMs, Xdata), 'r+--', ...
T, pH, y(sol_1st_opt, Xdata), 'm+-.', ...
'LineWidth', 2)
xlabel('T');
ylabel('pH');
zlabel('y');
legend({'Original Data', 'MultiStart MATLAB', '1stOpt'},...
'FontSize', 14, 'Location', 'best')
6 件のコメント
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_831317
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_831317
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_831337
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_831337
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_831371
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_831371
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_831828
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_831828
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_832282
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_832282
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_832481
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/519223-nonlinear-regression-with-two-variables#comment_832481
サインインしてコメントする。