Simultaneous lsqcurvefit for data set with shared parameters

6 次查看(过去 30 天)
Hi,
I'm a bit rusty on Matlab (if I ever was any good!) but I need to solve this problem to get some kinetic parameters for my work.
I'm trying to fit simultaneously 5 curves to get an estimation of 3 kinetic parameters. The equation is:
[HRP] concentration constant, [H2O2] and [ABTS] INITIAL concentration available.
For each set of ABTS concentration, I have a curve velocity(mM/s) vs H2O2 concentration.
I have been trying to solve this problem using lsqcurvefit but I'm getting errors (e.g. Unable to perform assignment because the indices on the left side are not compatible with the size of the right side) or the optimization stops as the initial values are the local minimum.
I have attached the script, I apologize for the mess - I tried to get bits and pieces from previous questions/topics.
My questions are: is lsqcurvefit the right tool for this simultaneous fit or multiple data set? and if sowhat would be the best way to recall all sets of data?
Many thanks for your answers!!!

采纳的回答

Matt J
Matt J 2022-10-18
编辑:Matt J 2022-10-18
I don't know if this was the solution you were expecting. The residuals don't look too bad, especially for such a small amount of data.
xdata = [50 98 196 394 592]; %H2O2 initial concentration, uM
ydata = 1e6*[6.7848E-07 7.58E-07 6.55E-07 6.63E-07 6.39E-07
1.0936E-06 1.07E-06 1.13E-06 1.24E-06 1.21E-06
1.3570E-06 1.56E-06 1.75E-06 1.83E-06 2.02E-06
1.5725E-06 1.85E-06 2.35E-06 2.58E-06 2.78E-06
1.6762E-06 2.05E-06 2.55E-06 2.83E-06 3.04E-06]; %SCALED
ABTS = [1.01 2.01 4.02 6.04 8.05]';%TRANSPOSED
HRP = 2.00758;%SCALED
PP_fun = @(x,xdata) (x(1).*HRP)./(1+(x(2)./xdata)+(x(3)./ABTS));
lb = [0 0 0];
ub = [inf inf inf];
opts=optimoptions('lsqcurvefit', 'OptimalityTolerance',1e-12,...
'StepTolerance',1e-12, ...
'FunctionTolerance',1e-12,'Display','iter');
%Derive x0 by re-arranging as linear equations
A=cat(3, -HRP.*ones(size(ydata)), ydata./xdata, ydata./ABTS); A=reshape(A,[],3);
b=-ydata(:);
x0=(A\b)'
x0 = 1×3
2.5000 58.8149 5.8011
[x,resnorm,residual]= lsqcurvefit(PP_fun, x0,xdata, ydata,lb,ub,opts)
Norm of First-order Iteration Func-count f(x) step optimality 0 4 0.381939 0.684 1 8 0.2667 10 0.0479 2 12 0.18611 20 0.00764 3 16 0.175932 11.2667 0.00768 4 20 0.175798 1.49256 0.00012 5 24 0.175798 0.0881065 3.84e-06 6 28 0.175798 0.00420428 1.84e-07 7 32 0.175798 0.000195329 4.71e-09 8 36 0.175798 1.13749e-05 8.13e-10 Local minimum possible. lsqcurvefit stopped because the final change in the sum of squares relative to its initial value is less than the value of the function tolerance.
x = 1×3
3.3227 101.5819 8.4517
resnorm = 0.1758
residual = 5×5
-0.0933 -0.1169 0.0197 0.0300 0.0603 -0.1718 -0.0012 0.0356 -0.0189 0.0307 -0.0577 0.0517 0.0924 0.1552 0.0175 -0.0670 0.0915 -0.0636 -0.0695 -0.1853 -0.0419 0.1113 0.0474 0.0606 -0.0372

更多回答(1 个)

Hiro Yoshino
Hiro Yoshino 2022-10-18
编辑:Hiro Yoshino 2022-10-18
Hope this helps you out: Problem-Based Optimization setup. This does not requires prior-knowlege on type of solver for your specific problem where the solver is choosed after giving your problem and constraints.
Also, a new feature for Optimization, Live Task, is available for you. This guides you set things up.
[Advice] I would say that you should make your question(s) more generalized, otherwise no one would easily grasp what you want to know.
  2 个评论
Barri_0089
Barri_0089 2022-10-18
Hi Hiro, Thanks for the suggestion! I realized that my question contained too many unecessary details and may have confused people. This was my first time posting here, so for the next post I will keep it simple!
Hiro Yoshino
Hiro Yoshino 2022-10-19
No worries. Congras on your first question post. Keep it simple and concise please.
I would reccomend to use optimization Live Task. This is very intuitive.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Nonlinear Least Squares (Curve Fitting) 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by