Chemical reaction rate with ODE?
7 views (last 30 days)
Show older comments
Hello im having some trouble solving a system of differential eqs. with ode45
The Chemical Reaction look like this
- A -> B+B (k1)
- B+C -> M (k2)
- B+D -> C (k3)
My function code
function [f] = kinetic(t,Conc,R,K)
k1=9.2*10^6*exp(108400/(R*K));
k2=2.5*10^14*exp(244600/(R*K));
k3=2.2*10^14*exp(317500/(R*K));
f=zeros(length(Conc),1);
f(1)=-k1*Conc(1);
f(2)=k1*Conc(1)^2-k2*Conc(2)*Conc(3)-k3*Conc(2)*Conc(4);
f(3)=-k2*Conc(2)*Conc(3)+k3*Conc(2)*Conc(4);
f(4)=-k3*Conc(2)*Conc(4);
And the main script
P=101325;
R=8.314;
K=1193;
Conc=[A B C D] %The initial values of the concentrations
[t, Conc]=ode45(@kinetic,[0:0.1:0.3],Conc,[],R,K);
When i run the script i get the following answer for
Conc
A B C D
NaN NaN NaN NaN
NaN NaN NaN NaN
NaN NaN NaN NaN
What im i doing wrong?
2 Comments
Marc
on 26 Oct 2013
Do you get an error from ode45? I assume you have defined the initial conditions.
Answers (2)
Youssef Khmou
on 27 Oct 2013
You did not mention the parameters A,B,C and D :
i tried with A=12.2;B=14.3;C=15.5;D=17.6; it gives :
Conc =
1.0e+030 *
0.0000 0.0000 0.0000 0.0000
-0.0000 -0.3894 0.4416 -0.4419
-0.0000 -0.7788 0.8831 -0.8837
-0.0000 -1.1683 1.3247 -1.3256
lisa
on 20 Feb 2014
I think the energy in the reaction rate expression should be negative, otherwise, the rate will be too large.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!