- rucklidge系统
function dx=rucklidgee(t,x) %定义子函数
a=2.2; b=7.7; %系统参数
%*****************************************
dx=zeros(3,1);
dx(1)=-a*x(1)+b*x(2)-x(2).*x(3);
dx(2)=x(1);
%状态变量之间的乘法要用点乘
dx(3)=-x(3)+x(2).*x(2);
- 主程序
%主程序
clear;
options=odeset('RelTol',1e-6,'AbsTol',[1e-6,1e-6,1e-6]);
t0=[0 1000]; % 迭代计算次数
x0=[1,0,0]; % 状态变量的初始值
[t,x]=ode45('rucklidgee',t0,x0,options); % 采用ODE45算法, rucklidgee调用子函数文件名称
n=length(t);
n1=round(n/2);
figure(1);
%hold on; %图像保留
plot(t(n1:n),x(n1:n,1)); % 状态变量x的时序图
xlabel('t','fontsize',20,'fontname','times new roman','FontAngle','normal');
ylabel('x1','fontsize',20,'fontname','times new roman','FontAngle','normal');
figure(2);
plot(x(n1:n,1),x(n1:n,3)); %x-z平面的相图
xlabel('x','fontsize',20,'fontname','times new roman','FontAngle','italic');
ylabel('z','fontsize',20,'fontname','times new roman','FontAngle','italic');
figure(3);
plot(x(n1:n,1),x(n1:n,2)); %x-y平面的相图
xlabel('x','fontsize',20,'fontname','times new roman','FontAngle','italic');
ylabel('y','fontsize',20,'fontname','times new roman','FontAngle','italic');
figure(4);
plot(x(n1:n,2),x(n1:n,3)); %y-z平面的相图
xlabel('y','fontsize',20,'fontname','times new roman','FontAngle','italic');
ylabel('z','fontsize',20,'fontname','times new roman','FontAngle','italic');
figure(5);
plot3(x(n1:n,1),x(n1:n,2),x(n1:n,3)); %x-y-z的三维相图
xlabel('x','fontsize',20,'fontname','times new roman','FontAngle','italic');
ylabel('y','fontsize',20,'fontname','times new roman','FontAngle','italic');
zlabel('z','fontsize',20,'fontname','times new roman','FontAngle','italic');
在这里插入图片描述