Problems with a simple system of ODE
Problems with a simple system of ODE
(OP)
Hello,
I have a simple system of ODE;
function xdot=test(t,x);
xdot=[
2*x(1)*(1-x(1)/2000)-(15*x(1)*x(2))/(x(1)+70);
1*x(2)*((15*x(1))/(x(1)+70)-9)];
return;
tspan=[0 50]; x0=[1000;20];
options=odeset('RelTol',0.01);
[t,x]=ode23('test',tspan,x0,options);
plot(t,x, '-')
xlabel('time');
ylabel('size');
As you can see, the RelTol is very high, still, I can't plot this, it says "busy" and it waits, waits, waits... nothing happens. I really can't understand, it's a simple system !
BTW, how can I put all the programs in a single m file ?
Thank you,
I have a simple system of ODE;
function xdot=test(t,x);
xdot=[
2*x(1)*(1-x(1)/2000)-(15*x(1)*x(2))/(x(1)+70);
1*x(2)*((15*x(1))/(x(1)+70)-9)];
return;
tspan=[0 50]; x0=[1000;20];
options=odeset('RelTol',0.01);
[t,x]=ode23('test',tspan,x0,options);
plot(t,x, '-')
xlabel('time');
ylabel('size');
As you can see, the RelTol is very high, still, I can't plot this, it says "busy" and it waits, waits, waits... nothing happens. I really can't understand, it's a simple system !
BTW, how can I put all the programs in a single m file ?
Thank you,





RE: Problems with a simple system of ODE
Also, the way the ODE solvers work is you put the ODE equation in a separate m-file function, then call that function. I don't know how to put everything in the same file; maybe someone else knows.
xnuke
"Live and act within the limit of your knowledge and keep expanding it to the limit of your life." Ayn Rand, Atlas Shrugged.
Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.