Question
I need to do the following in matlab : Animate your masterpiece by using the view([azimuth, elevation]) command inside a for loop. Fix the elevation
I need to do the following in matlab:
Animate your masterpiece by using the view([azimuth, elevation]) command inside a for loop. Fix the elevation at 10 degrees, but use the for loop variable so the azimuth runs from 0 to 720, corresponding to two complete revolutions. Change it by 1 degree on each iteration. Use the following command inside your for loop to create a pause of 0.05 seconds between each frame of your animation
Here is the code I have up until:
%% Question 1 A= [1 1 1; 1 2 1; 1 3 1]; b=[1;2;3]; AugAB=[A,b]; sz=size(AugAB); disp(sz); sprintf('The size of the augmented matrix is: 3 x 4 %d ')
%% Question 2 RAM=rref(AugAB)
%% Question 3 row1 = RAM(1, :); pivot_for_row1 = find(row1, 1); row2 = RAM(2, :); pivot_for_row2 = find(row2, 1); row3 = RAM(3, :); pivot_for_row3 = find(row3, 1);
%% Question 4 %{ The basic variables are: x1, x2 The free variable is: x3 The solutions can be written: x1=0+x3 ,x2=1 where x3 is free. %}
%% Questions 5-6 clc, close all figure % Set up a grid for each 3D plot. x = -5 : 1 : 5; % x will range from -5 to 5. y = -5 : 1 : 5; % y will range from -5 to 5. [X,Y] = meshgrid(x,y); base = surf(X,Y,0*X + 0*Y); % Draw the xy plane hold on grid on base.set('facealpha', 0.4); base.set('edgealpha', 0.15); base.set('facecolor', 'green'); darkgreen = [0 0.5 0 ]; % Plot the coordinate axis in the background L =6; t=-L: 0.1 :L; % Scale plot3(t, zeros(size(t)), zeros(size(t)), 'color', darkgreen, 'LineWidth', 3) plot3( zeros(size(t)), t, zeros(size(t)), 'color', darkgreen, 'LineWidth', 3) plot3( zeros(size(t)), zeros(size(t)), 1.5*t, 'color', darkgreen, 'LineWidth', 3) set(gca, 'FontSize', 20) % Add one reference marker at the tip of the positive x-axis. plot3( L, 0, 0, 'bd', 'MarkerSize', 9, 'MarkerFaceColor', 'green') view([120, 20]) % Students will add more code here. xlabel('x'); ylabel('y'); zlabel('z') title('Visualization of a System of Equations'); z = -5 : 0.01 : 5; x=-z; y=ones(size(z)); plot3(x, y, z, 'magenta', 'LineWidth', 4) rotate3d on view([100, 10]) axis equal
%% Questions 7-8 P1 = [3; 1; 3]; P2 = [3; 1; -3]; P3 = [-3; 1; -3]; P4 = [-3; 1; 3]; points = [P1 P2 P3 P4 P1] x1=points(1,:); y1=points(2,:); z1=points(3,:); plot3(x1,y1,z1,'g:','LineWidth',3) X = P1 for X = points disp(X) if isequal( A*X , b) % Test if AX equals b plot3(X(1), X(2), X(3), 'bo', 'MarkerSize', 16, 'MarkerFaceColor', 'green') else plot3(X(1), X(2), X(3), 'bo', 'MarkerSize', 16, 'MarkerFaceColor', 'red') end end
%% Question 9 % Set up a grid for each 3D plot. x = -5 : 1 : 5; % x will range from -5 to 5. y = -5 : 1 : 5; % y will range from -5 to 5. [X,Y] = meshgrid(x,y); % Shading methods are flat, faceted, and interp. shading faceted colormap cool % Try winter, summer, copper, hot, bone, cool, parula base.set('facecolor', 'green'); % Set the xy-plane back to green. % First plane a=1; b=1; c=1; d=1; Z=(d- a * X - b * Y)/c; p1 = surf(X,Y,Z) % Draw the plane defined by the first equation. p1.set('facealpha', 0.40) % Make the surface plot partially transparent. % Add the second plane here using an alpha value of 0.1 %Second Phase % Set up a grid for each 3D plot. x = -5 : 1 : 5; % x will range from -5 to 5. y = -5 : 1 : 5; % y will range from -5 to 5. [X,Y] = meshgrid(x,y); % Shading methods are flat, faceted, and interp. shading faceted colormap cool % Try winter, summer, copper, hot, bone, cool, parula base.set('facecolor', 'green'); % Set the xy-plane back to green. % First plane a=1; b=1; c=1; d=1; Z=(d- a * X - b * Y)/c; p1 = surf(X,Y,Z) % Draw the plane defined by the first equation. p1.set('facealpha', 0.40) % Make the surface plot partially transparent. % Add the second plane here using an alpha value of 0.1 a=1; b=2; c=1; d=2; Z=(d- a * X - b * Y)/c; p1 = surf(X,Y,Z) % Draw the plane defined by the first equation. p1.set('facealpha', 0.10)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started