Struggling to use ode 45
Show older comments
So here is my code: sys(m,
A0= 0.03;
m0= [0,0.1,0.3];
p0= [0.1,0.4,0.5];
mdot(1) = -m0(1) + 60*(5-A0)/(1+p0(1)^2) +A0;
mdot(2) = -m0(2) + 60*(5-A0)/(1+p0(2)^2) +A0;
mdot(3) = -m0(3) + 60*(5-A0)/(1+p0(3)^2) +A0;
mdot=[mdot(1),mdot(2),mdot(3)];
pdot(1)=-0.2*(p0(1)-m0(1));
pdot(2)=-0.2*(p0(2)-m0(2));
pdot(3)=-0.2*(p0(3)-m0(3));
pdot=[pdot(1),pdot(2),pdot(3)];
t0=0;
tspan=[0,800];
[y,t]=ode45(@odefun,tspan, m0, options);
plot(t,y);
Been staring at it for hours but it wont run.
?? ?
Accepted Answer
More Answers (1)
Eden Forster
on 2 Mar 2019
0 votes
Categories
Find more on Runge Kutta Methods 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!