发布网友 发布时间:2024-10-05 16:19
共3个回答
热心网友 时间:2024-10-05 16:58
t=250;
dt=0.01;
tlen=t/dt;
x=zeros(1,tlen);
y=zeros(1,tlen);
z=zeros(1,tlen);
for k=1:tlen-1
dx=(-y(k)-z(k))*dt;
dy=(x(k)+0.2*y(k))*dt;
dz=(0.2+z(k)*(x(k)-5))*dt;
x(k+1)=x(k)+dx;
y(k+1)=y(k)+dy;
z(k+1)=z(k)+dz;
end
f_h = figure('numbertitle','off');
a_h = axes('parent',f_h);
set(a_h,'box','on','projection','perspective','dataaspectratio',[1 1 1])
line(x,y,z)
热心网友 时间:2024-10-05 16:57
使用ode45热心网友 时间:2024-10-05 17:01
>> dy=inline('[-y(2)-y(3);y(1)+0.2*y(2);0.2+y(3)*(y(1)-5)]','t','y');
>> [x y]=ode45(dy,200,[0 0 0]);
>> plot3(y(:,1),y(:,2),y(:,3))