I want to find rate constant from function fminsearch.

6 次查看(过去 30 天)
clear all
t=15,30,60,120,240; %min
dCHMF/dt= -k1CHMF;
dCHMFCA/dt= -k2CHMFCA+k1CHMF;
dCFFCA/dt= -k3CFFCA+k2CHMFCA;
dCFDCA/dt= k4CFDCA;
CHMF initial =0.1 %mol/L
Conc.(mol/L)
t HMF HMFCA FFCA FDCA
15 0.04401 0.00127 0.00120 0.00000
30 0.04924 0.00097 0.00269 0.00000
60 0.03023 0.00575 0.00540 0.00005
120 0.03132 0.00877 0.01296 0.00007
240 0.04457 0.00053 0.00278 0.00000
objective function as follow from this equation.
I want to find k1,k2,k3 and k4 from fuction fminsearch.
  2 个评论
John D'Errico
John D'Errico 2022-1-22
编辑:John D'Errico 2022-1-22
5 data points, and you want to estimate 4 unknown parameters?
I would note that you spedify only ONE of the initial values, and there must be 4 initial values specified to solve any such problem.
Are those data points known EXACTLY, with no error at all? Surely not, since one of the species has concentration 0 at 4 of the 5 points. I wish you good luck.
Nattanit Benjangvisanu
I don't know how to wrote a code. I try to find k1,k2,k3,k4 another way but I can't. Matlab is hard for me lol.

请先登录,再进行评论。

回答(1 个)

John D'Errico
John D'Errico 2022-1-22
Here is a start. First, fminsearch will probably be a poor solver to use here. At least, make sure you have good starting values.
ANd since you have not specified initial values for the ODE, I'll assume they are all zero except for the one you DID specify.
syms CHMF(t) CHMFCA(t) CFFCA(t) CFDCA(t) k1 k2 k3 k4
EQ = [diff(CHMF) == -k1*CHMF;...
diff(CHMFCA) == -k2*CHMFCA+k1*CHMF;...
diff(CFFCA) == -k3*CFFCA+k2*CHMFCA;...
diff(CFDCA) == k4*CFDCA];
IC = [CHMF(0) == 0.1, CHMFCA(0) == 0, CFFCA(0) == 0, CFDCA(0) == 0];
sol = dsolve(EQ,IC)
sol = struct with fields:
CHMFCA: (k1*exp(-k2*t))/(10*(k1 - k2)) - (k1*exp(-k1*t))/(10*(k1 - k2)) CHMF: exp(-k1*t)/10 CFFCA: (k1*k2*exp(-k1*t))/(10*(k1 - k2)*(k1 - k3)) - (k1*k2*exp(-k2*t))/(10*(k1 - k2)*(k2 - k3)) + (k1*k2*exp(-k3*t))/(10*(k1 - k3)*(k2 - k3)) CFDCA: 0
You should see that the last component is identically zero, since it started out at zero concentration. That leaves you with 3 unknowns, and 5 data points for them on each curve. But the nice thing is, you now need not use an ode solver, since the analytical solution was easy to arrive at.
Just use an nonlinear least squares solver you want to use.
  3 个评论

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by