how to model kinetic reaction system

140 visualizaciones (últimos 30 días)
Anastasya Silitonga
Anastasya Silitonga el 24 de Mayo de 2020
Comentada: Star Strider el 1 de Mayo de 2021
Research area: Chemical kinetics
problem description: So this is parallel kinetics. I want to determine rate of reaction (as dCdt) and constant rate (as k) from experimental data that I have, time (as t) and concentration (as C). There are 6 variable called as mag,dag,tag,gly,ffa, and air.
so there are 6 constant rate and rate of reaction that I need to know, using ode23 or ode45. and the equations are described below:
dCdt(mag)=k1*Ctag*Cgly+2*k2*Cdag*Cgly-k3*Ctag*Cmag+k5*Cdag*Cair+k6*Cgly*Cffa;
dCdt(dag)=k1*Ctag*Cgly-k2*Cdag*Cgly+2*k3*Ctag*Cmag+k4*Ctag*Cair-k5*Cdag*Cair;
dCdt(tag)=-k1*Ctag*Cgly-k3*Ctag*Cmag-k4*Ctag*Cair;
dCdt(ffa)= k4*Ctag*Cair+k5*Cdag*Cair-k6*Cgly*Cffa;
dCdt(gly)=-k1*Ctag*Cgly-k2*Cdag*Cgly-k6*Cgly*Cffa;
dCdt(air)=-k4*Ctag*Cair-k5*Cdag*Cair+k6*Cgly*Cffa;
all I want to do is fit my data to this function to solve for k1,k2,k3,k4,k5,k6 and find each dCdt. I've tried make a code by using fminsearch and ode23, but I dont know how to define each concentration for ode so as finding each k. Can anybody help me with the code?
Thanks in advance.
function constantrate
clc
Tspan = [0.1 0.1]
constant=fminsearch(@rate, Tspan);
function constantrate = rate (k)
Data = [
60 90.5 5.2 1.1 10.5 2 3
120 90.6 5.1 1 10.1 1.8 3.3
180 90.7 5.1 1.4 12.5 1.9 4
240 90.7 5.4 2.1 10 1.7 4.5
];
t=Data(:,1); %time
Cmag=Data(:,2); %concentration of mag
Cdag=Data(:,3); %concentration of dag
Ctag=Data(:,4); %concentration of tag
Cgly=Data(:,5); %concentration of gly
Cair=Data(:,6); %concentration of air
Cffa=Data(:,7); %concentration of ffa
[tint, Cint]=ode23(@reaction,t,Cmag,[],k);
constantrate=sum((Cmag-Cint).^2);
plot (tint, Cint, 'r','o',t,Cmag,'b')
legend('calculation','experimental')
xlabel('time (min)')
ylabel('concentration (M)')
function dCdt=reaction(Ctag,Cmag,Cdag,Cgly,Cair,Cffa,k1,k2,k3,k4,k5,k6)
dCdt(mag)=k1*Ctag*Cgly+2*k2*Cdag*Cgly-k3*Ctag*Cmag+k5*Cdag*Cair+k6*Cgly*Cffa;
dCdt(dag)=k1*Ctag*Cgly-k2*Cdag*Cgly+2*k3*Ctag*Cmag+k4*Ctag*Cair-k5*Cdag*Cair;
dCdt(tag)=-k1*Ctag*Cgly-k3*Ctag*Cmag-k4*Ctag*Cair;
dCdt(ffa)= k4*Ctag*Cair+k5*Cdag*Cair-k6*Cgly*Cffa;
dCdt(gly)=-k1*Ctag*Cgly-k2*Cdag*Cgly-k6*Cgly*Cffa;
dCdt(air)=-k4*Ctag*Cair-k5*Cdag*Cair+k6*Cgly*Cffa;

Respuesta aceptada

Star Strider
Star Strider el 24 de Mayo de 2020
There are several examples on fitting differential equations to data in Answers. See: ODE and Data fitting and Parameter Estimation for a System of Differential Equations. There are many others.
  13 comentarios
Yasin Islam
Yasin Islam el 1 de Mayo de 2021
Thanky you very much for your fast response.
I do have bioinformatics toolbox, i'll take a look for other ode solvers, thanks for the hint.
I just copy the values after GA into lsqcurvefit, but unfortunately the outcome is not as good as starting from theta0=0 instead of GA values.
Once again, thank you very much! I had and propably still have no clue about matlab and was able to write a working code using your code from several posts.
Star Strider
Star Strider el 1 de Mayo de 2021
My pleasure!
I am somewhat surprised that the parameters estimated by ga as initial paremeter estimates for lsqcurvefit do not result in a better result than other initial estimates.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Productos


Versión

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by