问题描述
我正在用代码求解简单的 ODE 方程:
u=6;
z=2;
t=0:1:2000;
v0=0.04+0.001*u;
p0=0.03+0.001*z;
y0=[p0;v0];
t0=0;
b=0.2-0.01*u;
d=0.1;
c=0.4;
a=0.5;
function dx=f(t,x)
dx(1)=b*x(1)-d*x(1)*x(2);
dx(2)=c*x(2)-a*x(1)*x(2);
x=[x(1);x(2)];
endfunction
y=ode(y0,t0,t,f);
intdy-- t (=r1) illegal
where r1 is : 0.9560000000000D+03
t is not in [tcur-hu,tcur] = [r1,r2]
where r1 is : 0.9553617168733D+03 and r2 : 0.9555070182087D+03
intdy-- t (=r1) illegal
where r1 is : 0.9570000000000D+03
t is not in [tcur-hu,r2]
where r1 is : 0.9553617168733D+03 and r2 : 0.9555070182087D+03
lsoda-- problems due to intdy. itask=i1,tout=r1
where i1 is : 1
where r1 is : 0.9570000000000D+03
Illegal input detected (see printed message).
ode: lsoda exit with state -3.
我知道问题从 t=956 开始,但我不明白我该如何解决它。是否与变量的值有关?