3-D Visualization - The MathWorks - #20

/ 212


catalogue search
P. 01
P. 02
P. 03
P. 04
P. 05
P. 06
P. 07
P. 08
P. 09
P. 10
P. 11
P. 12
P. 13
P. 14
P. 15
P. 16
P. 17
P. 18
P. 19
P. 20
P. 21
P. 22
P. 23
P. 24
P. 25
P. 26
P. 27
P. 28
P. 29
P. 30
P. 31
P. 32
P. 33
P. 34
P. 35
P. 36
P. 37
P. 38
P. 39
P. 40
P. 41
P. 42
P. 43
P. 44
P. 45
P. 46
P. 47
P. 48
P. 49
P. 50


See other catalogues for The MathWorks

Text version of the page
1 Creating 3-D Graphs
Mesh and Surface Plots
The mesh and surf commands create 3-D surface plots of matrix data. If Z is a matrix for which the elements Z(i,j ) define theheightofasurfaceoveran underlying (i,j) grid, then
mesh(Z)
generates a colored, wire-frame view of the surface and displays it in a 3-D view. Similarly,
surf(Z)
generates a colored, faceted view of the surface and displays it in a 3-D view. Ordinarily, the facets are quadrilaterals, each of which is a constant color, outlined with black mesh lines, but the shading command allows you to eliminate the mesh lines (shading flat) or to select interpolated shading across the facet (shading interp).
Surface object properties provide additional control over the visual appearance of the surface. You can specify edge line styles, vertex markers, face coloring, lighting characteristics, and so on.
Visualizing Functions of Two Variables
The first step in displaying a function of two variables, z = /Tx,y),istogenerate X and Y matrices consisting of repeated rows and columns, respectively, over thedomainofthefunction. Thenusethesematricestoevaluateandgraph the function.
The meshgrid function transforms the domain specified by two vectors, x and y, into matrices X and Y. You then use these matrices to evaluate functions of two variables. The rows of X are copies of the vector x and the columns of Y are copies of the vector y.
To illustrate the use of meshgrid,considerthe sin(r)/r or sine function. To evaluate this function between -8 and 8 in both x and y, you need pass only one vector argument to meshgrid, which is then used in both directions.
[X,Y] = meshgrid(-8:.5:8); R = sqrt(X.A2 + Y.A2) + eps;
1-8

pageCatalog pdf di En 2012-06-22-01