![](https://csdnimg.cn/release/download_crawler_static/86829245/bg6.jpg)
实验4-常微分方程数值解
2. Runge-Kutta方法的MatLab实现
画出Lorenz系统图
clear all;clf;
options=odeset('RelTol',1e-5,'AbsTol',1e-5);
tspan=[0,100];x0=[1,2,3];
[t,x]=ode45('lorenz',tspan,x0,options);
l=length(x(:,1));
a=1;b=l;
figure(1)
plot3(x(a:b,3),x(a:b,1),x(a:b,2),‘b’);grid on;%画出三维相图
xlabel('z');ylabel('x');zlabel('y');
figure(2)
subplot(311);plot(t,x(a:b,1)) ;%画三分量演化图
subplot(312);plot(t,x(a:b,2))
subplot(313);plot(t,x(a:b,3))