|MATLAB Function Reference|
3-D shaded surface plot
surfc to view mathematical functions over a rectangular region.
surfc create colored parametric surfaces specified by
Z, with color specified by
creates a a three-dimensional shaded surface from the z components in matrix
[m,n] = size(Z). The height,
Z, is a single-valued function defined over a geometrically rectangular grid.
Z specifies the color data as well as surface height, so color is proportional to surface height.
creates a shaded surface using
Z for the color data as well as surface height.
Y are vectors or matrices defining the x and y components of a surface. If
Y are vectors,
size(Z). In this case, the vertices of the surface faces are
creates a shaded surface, with color defined by
C. MATLAB performs a linear transformation on this data to obtain colors from the current colormap.
specifies surface properties along with the data.
draws a contour plot beneath the surface.
h = surf(...) and h = surfc(...)
return a handle to a surface graphics object.
Abstractly, a parametric surface is parametrized by two independent variables,
j, which vary continuously over a rectangle; for example,
n. The three functions,
z(i,j), specify the surface. When
j are integer values, they define a rectangular grid with integer grid points. The functions
z(i,j) become three
Z. surface color is a fourth function,
c(i,j), denoted by matrix
Each point in the rectangular grid can be thought of as connected to its four nearest neighbors.
This underlying rectangular grid induces four-sided patches on the surface. To express this another way,
Z(:)] returns a list of triples specifying points in 3-space. Each interior point is connected to the four neighbors inherited from the matrix indexing. Points on the edge of the surface have three neighbors; the four points at the corners of the grid have only two neighbors. This defines a mesh of quadrilaterals or a quad-mesh.
Surface color can be specified in two different ways - at the vertices or at the centers of each patch. In this general setting, the surface need not be a single-valued function of
y. Moreover, the four-sided surface patches need not be planar. For example, you can have surfaces defined in polar, cylindrical, and spherical coordinate systems.
shading function sets the shading. If the shading is
C must be the same size as
Z; it specifies the colors at the vertices. The color within a surface patch is a bilinear function of the local coordinates. If the shading is
faceted (the default) or
C(i,j) specifies the constant color in the surface patch:
In this case,
C can be the same size as
Z and its last row and column are ignored, Alternatively, its row and column dimensions can be one less than those of
surfc functions specify the view point using
The range of
Z, or the current setting of the axes
ZLimMode properties (also set by the
axis function) determine the axis labels.
The range of
C, or the current setting of the axes
ClimMode properties (also set by the
caxis function) determine the color scaling. The scaled color values are used as indices into the current colormap.
Display a surface and contour plot of the
Color a sphere with the pattern of +1s and -1s in a Hadamard matrix.
Properties for surface graphics objects
Creating Surfaces and Meshes for related functions
Representing a Matrix as a Surface for more examples
Coloring Mesh and Surface Plots for information about how to control the coloring of surfaces