Consider the system of 3 ODEs originally developed to model
Consider the system of 3 ODEs originally developed to model atmospheric convection dt dy x (g z) y xy Bz dt Note that unlike other systems we have worked with in the course, this one is nonlinear. There are two nonlinearities in this otherwise autonomous system, one in the second equation where x will multiply z, the second in the third equation with the product xy. The solution (x, y,z) (0, 0, 0) nonetheless satisfies the equations This is the Lorenz system. To see how solutions to this system behave we will use a numerical solver and a three dimensional phase portrait, as demonstrated in the tutorial file. The solutions display a sort of butterfly\" pattern where the solutions orbit one point before jumping, seemingly at random times, to an orbit around a second point, and back Produce a numerical solution to this system of 3 ODEs using the built-in Matlab routine ode45 For parameters, use o 10,o 28, and B 8/3. Begin at values x(0) 12, y(0) 10, and z(0) 22. Have the 100 (a) Plot the results on a 3 dimensional phase plot for x, y and z. Use your First Name, Last Name, and Student Number as the title for the graph (e.g., Johnny Good, 1234567). Then save the graph as a .png file and upload it. (b) To see the behaviour as a function of time, x(t), y(t), and z(t) will be plotted as functions of t. First plot x(t) against t on a graph. Use your First Name, Last Name, and Student Number as the title for the graph (e.g., Johnny Good, 1234567\'). Then save the graph as a png file and upload it (c) Plot y(t) and z(t) against t on the same graph. Use the default blue color for y and red for 2, and use solid lines for both. Notice the oscillations around one point or another. Use your First Name, Last Name, and Student Number as the title for the graph (e.g., Johnny Good, 1234567). Then save the graph as a png file and upload it.
Solution
%Solution for the Lorenz equations in the time interval [0,20] with initial conditions [0,0,0]. clear all clc sigma=10; beta=8/3; rho=28; f = @(t,a) [-sigma*a(1) + sigma*a(2); rho*a(1) - a(2) - a(1)*a(3); -beta*a(3) + a(1)*a(2)]; %\'f\' is the set of differential equations and \'a\' is an array containing values of x,y, and z variables. %\'t\' is the time variable [t,a] = ode45(f,[0 20],[0 0 0]);%\'ode45\' uses adaptive Runge-Kutta method of 4th and 5th order to solve differential equations plot3(a(:,1),a(:,2),a(:,3)) %\'plot3\' is the command to make 3D plot