Solving Differential Equations using ODE45
显示 更早的评论
Hello!
I am trying to find S from t= 0 to 10 but I couldn't manage to sort the code with the tutorials, S depends on X and I keep getting the error that I need an array of length 21 as an initial condition:
Equations:
ds/dt= D*(10-S)+rs
dx/dt= -D*X+um*X;
rs=-(ms*X+u*X/Y)
u=um*S/(k+S);
Code:
%Constants:
um=0.8; k=0.01; ms=0.05; Y=0.44; D=0.3; So=10;
t=0:0.5:10;
dxdt=@(t,X) -D*X+um*X;
[t,X]=ode45(dxdt, t, 1);
rs=-(ms*X+u*X/Y);
u=um*S/(k+S);
dsdt=@(t,S) D*(10-S)+rs;
[t,S]=ode45(dsdt, t, 10);
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!