function f=fun(t,x)
r1=1;r2=0.4;r3=0.2;a=0.1;b=0.05;c=0.1;d=0.03;x10=10000;x20=1000;x30=100;
f=[x(1)*(r1-a*x(2)),x(2)*(-r2+b*x(1)-c*x(3)),x(3)*(-r3+d*x(2))];
[t,x]=ode45('fun',[0,20],[10000,1000,100])
subplot(1,2,1)
plot(t,x(:,1),'-',t,x(:,2),'-',t,x(:,3),':')
legend('x1(t)','x2(t)','x3(t)')
grid
subplot(1,2,2)
plot3(x(:,1),x(:,2),x(:,3))
grid
錯誤是在ode上
> [t,x]=ode45('fun',[0,20],[10000,1000,100])
錯誤使用 odearguments (line 93)
FUN 必須回傳列矢量。
出錯 ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/234504.html
標籤:其他硬件開發
