solutions of the Lorenz equations. Use the parameter values r = 28, o = 10 and B = 8/3. Initial values (x,z₁) are taken on a grid in the x-z plane with always yo = 3√2. For assessment purposes, the computational grid and the graphics code will be given in the Learner Template. To pass the assessment, every pixel in your figure needs to be colored correctly. My Solutions > (Hint: Some grid points may require as many as 33 Newton iterations to converge while others may require as few as three. Unfortunately, if you uniformly use 33 Newton iterations at every grid point, the MATLAB Grader may time out. You can accelerate your code by using a while loop instead of a for loop.)
1 r=28; sigma=10; beta=8/3; 2 x1=0; y1=0; z1=0; 3 x2=sqrt(beta* (r-1)); y2=sqrt(beta* (r-1)); z2=r-1; 4 x3=-sqrt(beta* (r-1)); y3=-sqrt(beta* (r-1)); z3=r-1; 5 nx=500; nz=500; 6 xmin=-40; xmax=40; zmin=-40; zmax=40; 7 x_grid=linspace(xmin, xmax,nx); z_grid=linspace(zmin, zmax,nz); 8 [X,Z]=meshgrid(x_grid,z_grid); 9 10 % Write Newton's method using every grid point as the initial condition 11 % Perform enough iterations that every initial condition converges to a root 12 % Save the x-values of the converged roots in the matrix X 13 % To pass the assessment, every pixel in the figure must be correctly colored 14 15 %!!!!!!!!! Set initial value y=3*sqrt(2) for all values (x,z) on the grid !!!!!!!!!! 16 17 18 19 20 21 22 eps=1.e-03; 23 X1 = abs (X-x1) < eps; X2 = abs(X-x2) < eps; X3 = abs(X-x3) < eps; 24 X4 = ~(X1+X2+X3); 25 figure; 26 map = 27 X=(X1+2*X2+3*X3+4*X4); 28 image([xmin xmax], [zmin zmax], X); set(gca, 'YDir', 'normal'); 29 xlabel('$x$', 'Interpreter', 'latex', 'FontSize', 14); 30 ylabel('$z$', 'Interpreter', 'latex', 'FontSize',14); 31 title('Fractal from the Lorenz Equations', 'Interpreter', 'latex', 'FontSize', 16) [1 0 0; 0 1 0; 0 0 1; 0 0 0]; colormap (map); %[red; green;blue; black]
Fractals from the Lorenz Equations Determine the fractal that arises from using Newton's method to compute the fixed-point Fractals from the Lorenz Equations Determine the fractal that arises from using Newton's method to compute the fixed-poi
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am