Solving coupled ODE (chemical kinetic)

Hello!
I am trying to solve the unknown parameters by fitting two ODEs with experimental data:
  1. dS/dt = (B(1)*x(1) + x(2)*x(3) - x(4)*S - V*k_6M*x(6)*S+V*k_GA*x(6)*x(7) - A_r*h_m * (S – Cs) + Q_inf*x(8) - Q_exf*S)/V;
  2. dCs/dt = h_m*(S-Cs)/B(2);
x(1), x(2), x(3), x(4), x(6), x(7), x(8), and S were determined experimentally at different time, t.
V, k_6M, k_GA, A_r, h_m, Q_inf, and Q_exf are known constants.
B(1), B(2), and initial value of Cs (Cs_0) are the unknown parameters that I am trying to figure out.
The difficult part for me is that the Cs cannot be determined experimentally, and it can only be estimated after determining Cs_0.
I have went through the following links, but still cannot find an answer:
I really appreciate it if anyone could provide some advice.
Thank you in advance!

1 Comment

I tried to use ode45 and lsqcurvefit to solve them. However, since Cs(t) is unknown I don't know how to make it work...
function S = kinetics(B,t,~);
% x(5) = S,x(9) = Cs
% B(1) = E_f, B(2) = K_s; B(3) = Cs_0;
k_6M = 2.5*1e10*4.3*1e-16;
k_GA = k_6M*2;
V = 447; %m3
A_r = 549; % m2
h_m = 0.002;
x0 = [2,0.03,2];
[T,Sv] = ode45(@DifEq,t,x0);
function dS = DifEq(t,x)
xdot = zeros(2,1);
xdot(1) = (B(1)*x(1) + x(2)*x(3) - x(4)*x(5) - V*k_6M*x(6)*x(5)+V*k_GA*x(6)*x(7) - A_r*h_m * (x(5) – x(9)) + Q_inf*x(8) - Q_exf*x(5))/V;
xdot(2) = h_m*(x(5)-x(9))/B(2);
dS = xdot;
end
S=Sv(:,1);
end

Sign in to comment.

Answers (1)

It is difficult for me to understand what you are doing.
I assume that ‘x(1)’ ... ‘x(9)’ are the parameters that you are intending to optimise in your ‘kinetics’ function. I would append ‘B(1)’ ... ‘B(3)’ (and perhaps also the initial conditions) to the parameter vector and let the optimisation function (lsqcurvefit or ga or whatever one you choose) estimate all of them. You then need only to provide appropriate initial parameter estimates for the entire parameter vector.
Note that you will need to have more data sets (time and concentrations at that particular time) than the number of parameters that you want to estimate, or it will not be possible to estimate any of them.

2 Comments

Hi Star Strider,
Sorry that I didn't explain it clearly. I have re-written the two ODEs:
dx(5)/dt = (B(1)*x(1) + x(2)*x(3) - x(4)*x(5) - V*k_6M*x(6)*x(5)+V*k_GA*x(6)*x(7) - A_r*h_m * (x(5) – x(9)) + Q_inf*x(8) - Q_exf*x(5))/V;
dx(9)/dt = h_m*(x(5)-x(9))/B(2);
V, k_6M, k_GA, A_r, h_m, Q_inf, and Q_exf are known constants.
'x(1)' ... 'x(9)' are the concentrations or flowrates of reactants.
I measured 'x(1)'… 'x(8)' experimentally as a function of time, but not for 'x(9)'. I would like to estimate the unknown constants, including 'B(1)', 'B(2)', and the initial value of 'x(9)', in Matlab. Since x(9) was not measured as a function of time, can I still construct a function to solve B(1), B(2) and initial value of x(9)?
Thank you for your kind help.
I am still somewhat lost.
Just assign the known values for ‘x(1)’...‘x(8)’ inside the ‘kinetics’ function, since there is no need to pass them as arguments, and only pass the parameters you want to solve for as the parameter arguments ‘B’. Use them appropriately in the ‘kinetics’ code. The optimiser you choose will estimate them correctly if given appropriate initial estimates for them.
Also, do not change ‘DifEq’. Keep it as it is:
function dS = DifEq(t,x)
xdot = zeros(2,1);
xdot(1) = (B(1)*x(1) + x(2)*x(3) - x(4)*x(5) - V*k_6M*x(6)*x(5)+V*k_GA*x(6)*x(7) - A_r*h_m * (x(5) – x(9)) + Q_inf*x(8) - Q_exf*x(5))/V;
xdot(2) = h_m*(x(5)-x(9))/B(2);
dS = xdot;
end
.

Sign in to comment.

Categories

Asked:

on 3 Aug 2020

Commented:

on 4 Aug 2020

Community Treasure Hunt

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

Start Hunting!