Solving 3 simultaneous first order differential equations

I need to solve the following set of differential equations in Matlab.
Here, um,Ks,Kp,a,sm,yxs,K1,K2-constant values s,p,x- variables
I need to solve the last three differential equations. As much as I understand, these are 3 first order simultaneous differential equations.
I can't figure out how to acknowledge the variation of u (first equation) in the rest of the equations.
Can anyone help with this?

 採用された回答

Mischa Kim
Mischa Kim 2013 年 12 月 28 日
編集済み: Mischa Kim 2013 年 12 月 28 日

0 投票

If none of the variables s, p, x depend on µ you can simply go ahead and solve the three differential equations. Once solved you can get µ as a function of time by plugging in s(t) and p(t) in the first equation.

5 件のコメント

Abhivyakti
Abhivyakti 2013 年 12 月 29 日
I tried using ode45 solver for this.
This is what i did :
function dy=sean(t,y) y=zeros(3,1); x=y(1); s=y(2); p=y(3);
%define constants
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;
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;
dy=[dx;ds;dp];
%define range of t
u=15; trange=[0,15];
init=[0.2 100 0.2];
[T,Y]=ode45(@sean,trange,init);
I get the following error :
??? Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be aware that exceeding your available stack space can crash MATLAB and/or your computer.
Error in ==> ode45
How to resolve this ?
Abhivyakti
Abhivyakti 2013 年 12 月 29 日
Hey
I have resolved the recursion error. The problem is, that my program doesn't seem to work.
This is what I have used :
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];
I give the following 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]);
In the output Y, I am just getting the initial values of the three variables i.e x,s &p, for each corresponding value of time.
i.e
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
What am i doing wrong here?
Mischa Kim
Mischa Kim 2013 年 12 月 29 日
You are really close. Remove the y=zeros(3,1); statement. With this statement you are basically setting the derivatives equal to zero at each time step.
Ranganatha B R
Ranganatha B R 2019 年 6 月 5 日
If you remove that you will get an error as to y is not defined. You cannot have an expression called y(1)
Torsten
Torsten 2019 年 6 月 5 日
編集済み: Torsten 2019 年 6 月 5 日
y is one of the inputs for function "react". Thus there will be no error removing "y=zeros(3,1)".

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

その他の回答 (0 件)

カテゴリ

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

質問済み:

2013 年 12 月 26 日

編集済み:

2019 年 6 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by