Solving Differential Equations using ODE45
Show older comments
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);
Accepted Answer
More Answers (0)
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!