% Kartik's MATLAB session with the Lorenz model (chaos!) % Consider the system % dx/dt = 10*(-x+y) % dy/dt = 28*x-y-x*z % dz/dt = -10/3*z + x*y % Let us examine this system for the following initial conditions % [x0,y0,z0] = [5,5,5] and [x0,y0,z0] = [5.01,5,5] % Our system of differential equations is in the file % lorenzfunc.m (look at the calling sequence in this file!) % We will solve the initial value problem using MATLAB's ode45 % function % Kartik's MATLAB session Nov 30, 2005. [t,x] = ode45(@lorenzfunc,[0 20],[5 5 5]'); figure(1) plot(t,x(:,1)); % Let us label the axes and the plot legend('Initial condition [5 5 5]'); xlabel('time t'); ylabel('variable x'); [t,x] = ode45(@lorenzfunc,[0 20],[5.01 5 5]'); figure(2); plot(t,x(:,1)); legend('Initial condition [5.01 5 5]'); xlabel('time t'); ylabel('variable x'); figure(3); plot(x(:,1),x(:,2)); % Label the axes again xlabel('x'); ylabel('y'); figure(3); plot(x(:,1),x(:,3)); % Label the axes again xlabel('x'); ylabel('z');