Solving 3 simultaneous first order differential equations
2 views (last 30 days)
Show older comments
Abhivyakti
on 29 Dec 2013
Commented: Walter Roberson
on 29 Dec 2013
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.
1 Comment
Walter Roberson
on 29 Dec 2013
Should be merged with duplicate http://www.mathworks.co.uk/matlabcentral/answers/110772-solving-3-simultaneous-first-order-differential-equations
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!