1 / 9

ELG 3120 Lab 2

ELG 3120 Lab 2. TAs Wei Zhang Ozgur Ekici (Section A) (Section B). Plotting functions. Line Plots of 3-D Data The 3-D analog of the plot function is plot3 . If x , y , and z are three vectors of the same length, plot3(x,y,z)

Download Presentation

ELG 3120 Lab 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ELG 3120 Lab 2 TAs Wei Zhang Ozgur Ekici (Section A) (Section B)

  2. Plotting functions

  3. Line Plots of 3-D DataThe 3-D analog of the plot function is plot3. If x, y, and z are three vectors of the same length, plot3(x,y,z) generates a line in 3-D through the points whose coordinates are the elements of x, y, and z and then produces a 2-D projection of that line on the screen.

  4. Setting the Viewpoint with Azimuth and ElevationAzimuth and Elevation • The view command specifies the viewpoint by defining azimuth and elevation with respect to the axis origin. Azimuth is a polar angle in the x-y plane, with positive angles indicating counter-clockwise rotation of the viewpoint. Elevation is the angle above (positive angle) or below (negative angle) the x-y plane.

  5. Axis Labels and Titles • The xlabel, ylabel, and zlabel commands add x-, y-, and z-axis labels. The title command adds a title at the top of the figure. • Example: xlabel(‘second'); ylabel('sin(t)'); title('Graph of the sine function');

  6. Setting Axis Limits • By default, MATLAB finds the maxima and minima of the data to choose the axis limits to span this range. • The axis command enables you to specify your own limits axis([xmin xmax ymin ymax]) • or for three-dimensional graphs, axis([xmin xmax ymin ymax zmin zmax]) • Use the command axis auto to reenable MATLAB automatic limit selection.

  7. Multiple Plots in One Figure • The subplot command enables you to display multiple plots in the same window or print them on the same piece of paper. Typing subplot(m,n,p) partitions the figure window into an m-by-n matrix of small subplots and selects the pth subplot for the current plot. The plots are numbered along first the top row of the figure window, then the second row, and so on. For example, these statements plot data in four different subregions of the figure window.

  8. Example: t = 0:pi/10:2*pi; [X,Y,Z] = cylinder(4*cos(t)); subplot(2,2,1); mesh(X) subplot(2,2,2); mesh(Y) subplot(2,2,3); mesh(Z) subplot(2,2,4); mesh(X,Y,Z)

More Related