代码如下:
clear;clc;
[T,Y] = ode45(@Lorenz,[0 300],[0.1;0.1;0.1]);
hold on
plot3(Y(:,3),Y(:,1),Y(:,2),'b','LineWidth',0.5);
view(-30,40);
xlabel('z(t)','FontName','Times New Roman','FontSize',15);
ylabel('x(t)','FontName','Times New Roman','FontSize',15);
zlabel('y(t)','FontName','Times New Roman','FontSize',15);
hold off
function dy = Lorenz(~,y)
a=10;
b=8/3;
c=28;
dy = zeros(3,1);
% a column vector
dy(1) = a*(y(2) - y(1));
dy(2) = -y(1) * y(3)+c*y(1)-y(2);
dy(3) = y(1) * y(2)-b*y(3);
end
|