Simultaneous lsqcurvefit for data set with shared parameters
10 views (last 30 days)
Show older comments
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!!!
0 Comments
Accepted Answer
Matt J
on 18 Oct 2022
Edited: Matt J
on 18 Oct 2022
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)'
[x,resnorm,residual]= lsqcurvefit(PP_fun, x0,xdata, ydata,lb,ub,opts)
More Answers (1)
Hiro Yoshino
on 18 Oct 2022
Edited: Hiro Yoshino
on 18 Oct 2022
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 Comments
Hiro Yoshino
on 19 Oct 2022
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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!