Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "ELG 3120 Lab 2 TAs Wei Zhang Ozgur Ekici (Section A) (Section B)"— 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 Data The 3-D analog of the plot function is plot3. If x, y, and z are three vectors of the same length, plot3 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 Elevation Azimuth 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. view

5

6 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. xlabel ylabel zlabel title Example: xlabel(‘second'); ylabel('sin(t)'); title('Graph of the sine function');

7 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 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.

8 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 subplot(m,n,p) partitions the figure window into an m -by- n matrix of small subplots and selects the p th 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.

9 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)


Download ppt "ELG 3120 Lab 2 TAs Wei Zhang Ozgur Ekici (Section A) (Section B)"

Similar presentations


Ads by Google