Solving 3 simultaneous first order differential equations

7 ビュー (過去 30 日間)
Abhivyakti
Abhivyakti 2013 年 12 月 29 日
コメント済み: Walter Roberson 2013 年 12 月 29 日
I need to solve the following set of differential equations using MATLAB.
Here, um,Ks,Kp,a,sm,yxs,K1,K2-constant values s,p,x- variables
I am using the function ode45 for this. This is my program :
function dydt=react(t,y)
dydt=zeros(3,1);
um=0.71;
ks=37.72;
sm=510;
kp=160.83;
a=0.81;
yxs=0.03;
ms=0.0011;
k1=33.04;
k2=0.0001;
y=zeros(3,1);
x=y(1);
s=y(2);
p=y(3);
dx=(um*(s/(s+ks))*((1-(s/sm))^a)*(kp/(kp+p)))*x;
ds=-1*((um/yxs)*(s/(s+ks))*((1-(s/sm))^a)*(kp/(kp+p)) + ms)*x;
dp=(k1*(um*(s/(s+ks))*((1-(s/sm))^a)*(kp/(kp+p)))+k2)*x;
dydt=[dx;ds;dp];
On giving this command :
[T,Y]=ode45('react',[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],[0.2 100 0.2]);
or this command :
[T,Y]=ode45('react',[0 15],[0.2 100 0.2]);
All I get is this :
Y =
0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000 0.200000000000000 100 0.200000000000000
i.e the equations are not being solved. I am just getting the initial values of my inputs (i.e x,s,p) as the output.
Any help is appreciated.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 12 月 29 日
Because in react function you added
y=zeros(3,1);
Remove this line
  2 件のコメント
Abhivyakti
Abhivyakti 2013 年 12 月 29 日
Thankyou soo much! That worked.
Another doubt I have. I need to plot the graphs of 'dx/dt vs t', 'ds/dt vs t' and 'dp/dt vs t'.
I cannot figure out how to get an equation between 'dx/dt and t' , i.e how to consider the variation of 'dx/dt' with 't' in one equation as 'dx/dt varies as the variation of 's' & 'p' wrt 't'.
Abhivyakti
Abhivyakti 2013 年 12 月 29 日
Basically , I think if I have the equation of each 'x' with respect to 't', I can differentiate that & obtain 'dx/dt'. So, can I get the equation of 'x' wrt 't' ( as its obtained using function dsolve) by using 'ode23 or ode45' ????

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by