egr 115 introduction to computing for engineers complex numbers & 3d plots – part 3 monday 10 nov...

12
EGR 115 Introduction to Computing for Engineers Complex Numbers & 3D Plots – Part 3 Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers

Upload: april-ellis

Post on 18-Jan-2018

225 views

Category:

Documents


0 download

DESCRIPTION

More 3D Plotting Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers Building Objects from 3D Lines  A 3D line object: o line(x_values, y_values, z_values); % A 3D Line Example x = [0 1]; y = [0 0]; z = [0 0]; line(x, y, z); title('A 3D Line Plot in MATLAB') grid xlabel('x-axis'); ylabel('y-axis'); zlabel('z-axis'); Coordinates: (0, 0, 0) Coordinates: (1, 0, 0) You will need to 3D Rotate the default view!! Plotting_3D_Example.m Slide 3 of 12

TRANSCRIPT

EGR 115 Introduction to Computing for Engineers Complex Numbers & 3D Plots Part 3 Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers Lecture Outline Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers More 3D Plotting Slide 2 of 12 More 3D Plotting Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers Building Objects from 3D Lines A 3D line object: o line(x_values, y_values, z_values); % A 3D Line Example x = [0 1]; y = [0 0]; z = [0 0]; line(x, y, z); title('A 3D Line Plot in MATLAB') grid xlabel('x-axis'); ylabel('y-axis'); zlabel('z-axis'); Coordinates: (0, 0, 0) Coordinates: (1, 0, 0) You will need to 3D Rotate the default view!! Plotting_3D_Example.m Slide 3 of 12 More 3D Plotting Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers Build an x, y, z coordinate frame Three lines (red=x, green=y, and blue=z) % Building a 3D Coordinate Frame line([0 1], [0 0], [0 0],'Color','r', 'LineWidth',3); line([0 0], [0 1], [0 0],'Color','g', 'LineWidth',3); line([0 0], [0 0], [0 1],'Color','b', 'LineWidth',3); title('A 3D Coordinate Frame') grid on xlabel('x-axis'); ylabel('y-axis'); zlabel('z-axis'); Default viewpoint - Looking down the z-axis Default viewpoint - Looking down the z-axis Rotated viewpoint - view(azmuth, elevation) Rotated viewpoint - view(azmuth, elevation) Plotting_3D_Lines.m Slide 4 of 12 More 3D Plotting Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers Now lets Label the Axes text(x, y, z, 'string') o Put the string at location (x, y, z)!! % Building a 3D Coordinate Frame... line([0 0], [0 0], [0 1],'Color','b', 'LineWidth', 3); text(0, 0, 1.1,'Z','Color','b','FontSize',14); view(130, 30); % Set the viewpoint... Label for the z-axisGo just beyond the end of the z-axis Set the Az = 130 and El = 30 Plotting_3D_Lines.m Slide 5 of 12 More 3D Plotting 3D Rotations - Rotate a 3D Line Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers Rotate a 3D Line Place a 3D line directly on the x-axis o Line starts at (0, 0, 0) and ends at (0, 0, 1) Rotate this line by deg about the z-axis Plotting_3D_Lines_video.m Plotting_3D_Lines.m Slide 6 of 12 More 3D Plotting 3D Rotations - Rotate a 3D Line Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers What are the new coordinates of the rotated line? Plotting_3D_Lines.m Slide 7 of 12 More 3D Plotting 3D Rotations - Rotate a 3D Line Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers Rotate a 3D Line Place a 3D line directly on the y-axis o Starts at (0, 0, 0) and ends at (0, 1, 0) Rotate this line by deg about the z-axis Plotting_3D_Lines_video.m Plotting_3D_Lines.m Slide 8 of 12 More 3D Plotting 3D Rotations - Rotate a 3D Line Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers Rotate a 3D Line Place a 3D line directly on the z-axis o Starts at (0, 0, 0) and ends at (0, 0, 1) Rotate this line by deg about the z-axis Slide 9 of 12 More 3D Plotting 3D Rotations Rotate all 3 Axes Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers Rotate all three lines at the same time about the z-axis Equivalent to rotating a coordinate system Starting x, y, z axes X-axisY-axisZ-axis Ending x, y, z axes new X-axis new Y-axis new Z-axis Slide 10 of 12 More 3D Plotting 3D Rotations Rotate all 3 Axes Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers Plotting_3D_Lines_video.m Plotting_3D_Lines.m Slide 11 of 12 Next Lecture Monday 10 Nov 2014 EGR 115 Introduction to Computing for Engineers More 3D Plotting Slide 12 of 12