EGR 106 Lecture 11 Three Dimensional Plotting - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

EGR 106 Lecture 11 Three Dimensional Plotting

Description:

EGR 106 Lecture 11. Three Dimensional Plotting. 3-D Line Plots. Mesh and Surface Plots ... explode=[0 0 1 0]; pie3(X,explode) The View Command. view(az,el) ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 27
Provided by: gatew318
Category:

less

Transcript and Presenter's Notes

Title: EGR 106 Lecture 11 Three Dimensional Plotting


1
EGR 106 Lecture 11Three Dimensional Plotting
  • 3-D Line Plots
  • Mesh and Surface Plots
  • Special Plots
  • View Command
  • Textbook 9.1 9.4

2
3-D Line Plots
  • Recall 2-D plotting
  • plot(x,y,line specifier,PropertyName,Propert
    yValue)
  • Extend to 3-D
  • plot3(x,y,z,line specifier,PropertyName,Prop
    ertyValue)

3
3-D Line Plots - Example
  • t00.16pi
  • xsqrt(t).sin(2t)
  • ysqrt(t).cos(2t)
  • z0.5t
  • plot3(x,y,z,'k','linewidth',1)
  • grid on
  • xlabel('x') ylabel('y') zlabel('z')

4
Mesh and Surface Plots
  • A function of two variables
  • z f(x,y)
  • can be represented graphically as a surface.
  • First step
  • Define a grid of x and y values

5
Example -1? x ? 3, 1? y ? 4
6
Matlab Command to Create Grid
  • gtgt x -13
  • gtgt y14
  • gtgt X,Ymeshgrid(x,y)
  • X
  • -1 0 1 2 3
  • -1 0 1 2 3
  • -1 0 1 2 3
  • -1 0 1 2 3
  • Y
  • 1 1 1 1 1
  • 2 2 2 2 2
  • 3 3 3 3 3
  • 4 4 4 4 4

7
Making Mesh and Surface Plots
  • Example (Gilat text 2nd Editions Cover Figure)

8
Mesh Plot
x-3.23 y-3.23 X,Ymeshgrid(x,y) Z1.8.
(-1.5sqrt(X.2Y.2)).cos(0.5Y).sin(X) mesh(X
,Y,Z) xlabel('x') ylabel('y')
zlabel('z') title('Mesh Plot')
9
Mesh Plot mesh(X,Y,Z)
10
Surface Plot surf (X,Y,Z)
11
Mesh and Contour Plot meshc(X,Y,Z)
12
Surface and Contour Plot surfc(X,Y,Z)
13
Surface Plot with Lighting surfl(X,Y,Z)
14
Waterfall Plot waterfall(X,Y,Z)
15
2-D Contour Plot contour(X,Y,Z,25)
Number of contour lines
16
3-D Contour Plot contour3(X,Y,Z,25)
17
Filled Contour Plot contourf(X,Y,Z,25)
18
Special Plots
  • Sphere
  • Cylinder
  • 3-D Bar Plot
  • 3-D Pie Chart

19
Sphere Plot
X,Y,Zsphere(20) surf(X,Y,Z) xlabel('x')
ylabel('y') zlabel('z') axis square title('Plot
of a Sphere')
20
Cylinder Plot
tlinspace(0,pi,20) r1sin(t) X,Y,Zcylinder(
r) surf(X,Y,Z) axis square title('Plot of a
Cylinder')
21
3-D Bar Plot
Y1 6 7 2 6 7 3 5 7 4 5 7 3 4 7 2 3 6 1 2
7 bar3(Y) title('3D Bar Plot')
22
3-D Pie Plot
X5 9 14 20 explode0 0 1 0 pie3(X,explode)
23
The View Command
view(az,el) where az and el are angles given in
degrees
24

View Command Example
x-3.23 y-3.23 X,Ymeshgrid(x,y) Z1.8.
(-1.5sqrt(X.2Y.2)).cos(0.5Y).sin(X) surf(X
,Y,Z) xlabel('x') ylabel('y') zlabel('z')
25

View Command (cont.)
view(0,25)
view(30,25)
view(90,25)
view(60,25)
26

View Command (cont.)
view(0,0)
view(90,90)
Write a Comment
User Comments (0)
About PowerShow.com