% Animates the solution of the Lorenz equations % initial conditions y0 = [8 9 9.5]; ystart = y0; % timestepping data: tstep = 0.4; nstep = 200; % labelling axes axis([-20 20 0 40]) xlabel('x','FontSize',20) ylabel('z','FontSize',20) % creation and acquisition of frames for i = 1:nstep tspan = 0:tstep/100:tstep; [t,y] = ode45(@lorenz,tspan,ystart); line(y(:,1),y(:,3)) hold on ystart = y(101,:) h = gcf; M(i) = getframe(h,[5 5 480 380]); end movie(M); movie2avi(M,'butterflyr21','fps',4);