[求助]我在用数值法求解微分方程时老是出错
我要求解微分方程:
dx/dt=-0.15*y(t)
dy/dt=-0.1*x(t)
x0=10000,y0=5000
代码:帮忙看一下
function xdot=a(t,x)
xdot=zeros(2,1);
xdot(1)=-0.15*x(2);
xdot(2)=-0.10*x(1);
存为a.m
>> t0=-10;tf=20;
x0=[10000 5000]
[t,x]=ode23('a',t0,tf,x0);
plot(x(:,1),x(:,2))
x0 =
10000 5000
Warning: Obsolete syntax. Use ode23(fun,tspan,y0,...) instead.
(Type "warning off MATLAB:odearguments:ObsoleteSyntax" to suppress this warning.)
> In C:\MATLAB6p5\toolbox\matlab\funfun\private\odearguments.m at line 39
In C:\MATLAB6p5\toolbox\matlab\funfun\ode23.m at line 154
>>