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.
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 Exchange에서 Chemistry에 대해 자세히 알아보기

질문:

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