![](https://csdnimg.cn/release/download_crawler_static/86717374/bg1.jpg)
1、首先使用四阶 Runge-Kutta 法解方程组解Lorenz 方程,取初值
x(0)=-1,y(0)=0,z(0)=1,积分时间步长0.01,参数a=16,b=4,c=45.92
主程序:
x0=[-1,0,1];
t0=0.001:0.01:200;
[t,x]=ode45('Lorenz',[0.001:0.01:200],x0);
X=x(:,1);
Y=x(:,2);
Z=x(:,3);
subplot(2,2,1);
plot3(Z,Y,X);
grid;
title('Z-Y-X');
subplot(2,2,2);
plot(X,Y);
grid;
title('X-Y');
subplot(2,2,3);
plot(X,Z);
grid;
title('X-Z');
subplot(2,2,4);
plot(Y,Z);
grid;
title('Y-Z');
figure(2);
plot(t,x);
legend('x','y','z');
Lorenz函数:
function dx=Lorenz(t,x)
dx(1)=16*(x(2)-x(1));
dx(2)=45.92*x(1)-x(1)*x(3)-x(2);
dx(3)=x(1)*x(2)-4*x(3);
dx=dx(:);
得到图形如下: