程序代码: 例1 f=@(t,x)[-8/3*x(1)+x(2)*x(3);-10*x(2)+10*x(3);-x(1)*x(2)+28*x(2)-x(3)]; t_final=100;x0=[0;0;1e-10]; [t,x]=ode45(f,[0,t_final],x0);plot(t,x),figure; plot3(x(:,1),x(:,2),x(:,3)); axis([1 60 -20 20 -20 25]); 练习1. f=@(t,x)[x(2)+x(1)*(1-x(1)^2-x(2)^2);-x(1)+x(2)*(1-x(1)^2-x(2)^2)]; t_final=100;x0=[0;1e-10]; [t,x]=ode45(f,[0,t_final],x0);plot(t,x),figure; plot(x(:,1),x(:,2)); axis([-1 1 -1 1]) 练习3. a=1 b=0.3 d=0.1 f=@(t,x)[x(1)*(1-x(1))-a*x(1)*x(2)/(x(1)+d);b*x(2)*(1-x(2)/x(1))] t_final=100;x0=[3,3]; [t,x]=ode45(f,[0,t_final],x0);plot(t,x),figure; plot(x(:,1),x(:,2)); axis([0 1 0 1]) clear;clc a=1 b=0.2 d=0.1 f=@(t,x)[x(1)*(1-x(1))-a*x(1)*x(2)/(x(1)+d);b*x(2)*(1-x(2)/x(1))] t_final=100;x0=[3,3]; [t,x]=ode45(f,[0,t_final],x0);plot(t,x),figure; plot(x(:,1),x(:,2)); axis([0 1 0 1]) |