How can I use levenberg-marquardt algorithm with two variables

11 visualizaciones (últimos 30 días)
Hello, everyone.
I started to use lsqcurvefit function in matlab for estimating the parameters in reaction kinetics.
My reaction kinetics are like this => r = k1[a][b] / (1+k2[a]+k3[b])^2
When I tried to use lsqcurvefit function, it demands only one variable x, however in my kinetics there are two variables a and b for output(reaction rate r).
Is there any way that can estimate reaction constant parameters k1,k2,k3 with two reaction variables a and b in kinetics?
I searched in matlab to solve this problem, but I couldn't find it.
I hope I could get good reply at here.
Thanks!
  4 comentarios
J. Alex Lee
J. Alex Lee el 29 de Mzo. de 2021
As @Star Strider's answer shows, I guess no, it is not important for you to know what the "residual function" is, because lsqcurvefit will automagically define it for you based on the model function that you give it. But it is definitely necessary for estimation since it is what defines "how far is your model from your data at this current set of estimates".
As for estimation and validation samples, I don't know if that's a typical thing for these types of goals, but if you're not going to use all available data I suppose I'd throw another caution out there to make sure you sample well...depending on how noisy your data is, 8 data points for 3 parameters doesn't seem like a lot, but i guess also depends on how "rigid" the model is...
Taeksang Yoon
Taeksang Yoon el 30 de Mzo. de 2021
Oh, I see.
I agree with your opinion. I think I need more experimental data, or modify my model with other assumptions.
Thanks for the reply!

Iniciar sesión para comentar.

Respuesta aceptada

Star Strider
Star Strider el 29 de Mzo. de 2021
It will be necessary to parameterize the ‘k’ constants (that you want to estimate) as:
k1 = p(1)
k2 = p(2)
k3 = p(3)
If the independent variable data are ‘a’ and ‘b’ and the dependent variable is ‘r’, then the data will be:
x = [a(:) b(:)];
y = r(:);
the objective function will be:
kinfcn = @(b,x) p(1).*x(:,1}.*x(:,2) ./ (1 + p(2).*x(:,1) + p(3).*x(:,2)).^2;
and the lsqcurvefit call would then be:
B = lsqcurvefit(kinfcn, rand(3,1), x, y, zeros(1,3))
The ‘zeros(1,3)’ prevents the kinetic constants (the ‘k’ parameters from being negative, since if I remember correctly, they should always be greater than 0.
  5 comentarios
Taeksang Yoon
Taeksang Yoon el 31 de Mzo. de 2021
Oh, I got it.
Thanks for the corrected code and the result!
I also get the estimation result by using curve fitting toolbox, and it also shows the almost same result.
Star Strider
Star Strider el 31 de Mzo. de 2021
As always, my pleasure!
I do not have the Curve Fitting Toolbox, since I can do everything I need to do with the Statistics and Machine Learning Toolbox and the Optimization Toolbox and Global Optimization Toolbox.

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by