Chemical reaction rate with ODE?

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 件のコメント

Marc
Marc 2013 年 10 月 26 日
Do you get an error from ode45? I assume you have defined the initial conditions.
Jonas Hoen
Jonas Hoen 2013 年 10 月 26 日
I dont get an error only the NaN [A B C D] is replaced by a calculated mol pr volume
This is the result i get
Conc =
0.5108 0 0.0020 0.5469
NaN NaN NaN NaN
NaN NaN NaN NaN
NaN NaN NaN NaN

サインインしてコメントする。

回答 (2 件)

Youssef  Khmou
Youssef Khmou 2013 年 10 月 27 日

0 投票

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

1 件のコメント

Jonas Hoen
Jonas Hoen 2013 年 10 月 27 日
If i insert the values in the function i get what u get but isnt the ODE function supposed to get the initial values from the script and not write it directly in the function?

サインインしてコメントする。

lisa
lisa 2014 年 2 月 20 日

0 投票

I think the energy in the reaction rate expression should be negative, otherwise, the rate will be too large.

カテゴリ

ヘルプ センター および File ExchangeChemistry についてさらに検索

質問済み:

2013 年 10 月 26 日

回答済み:

2014 年 2 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by