Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

3-D shaded surface plot

`surf(Z)`

surf(Z,C)

surf(X,Y,Z)

surf(X,Y,Z,C)

surf(...,'* PropertyName*',PropertyValue)

surf(ax,...)

h = surf(...)

`surf(Z)`

creates a three-dimensional
shaded surface from the *z* components in matrix `Z`

,
using `x`

`=`

`1:n`

and `y`

`=`

`1:m`

,
where `[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. The values in `Z`

can
be numeric or datetime or duration values.

`surf(Z,C)`

plots the height
of `Z`

, a single-valued function defined over a geometrically
rectangular grid, and uses matrix `C`

, assumed to
be the same size as `Z`

, to color the surface. See Coloring
Mesh and Surface Plots for information on defining `C`

.

`surf(X,Y,Z)`

uses `Z`

for
the color data and surface height. `X`

and `Y`

are
vectors or matrices defining the `x`

and `y`

components
of a surface. If `X`

and `Y`

are
vectors, `length(X)`

`=`

`n`

and `length(Y)`

`=`

`m`

,
where `[m,n]`

`=`

`size(Z)`

.
In this case, the vertices of the surface faces are *(X(j),
Y(i), Z(i,j))* triples. To create X and Y matrices for arbitrary
domains, use the `meshgrid`

function. The values
in `X`

, `Y`

, or `Z`

can
be numeric or datetime or duration values.

`surf(X,Y,Z,C)`

uses `C`

to
define color. MATLAB^{®} performs a linear transformation on this
data to obtain colors from the current colormap.

`surf(...,'`

specifies surface properties along with the data. For a list of properties,
see Chart Surface Properties.* PropertyName*',PropertyValue)

`surf(ax,...)`

plots into
the axes `ax`

instead of the current axes (`gca`

).

`h = surf(...)`

returns a
handle to a chart surface graphics object.

Was this topic helpful?