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.

Create surface object

`surface(Z) `

surface(Z,C)

surface(X,Y,Z)

surface(X,Y,Z,C)

surface(x,y,Z)

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

surface(ax,...)

h = surface(...)

For a list of properties, see Primitive Surface Properties.

`surface`

is the low-level function for creating
surface graphics objects. Surfaces are plots of matrix data created
using the row and column indices of each element as the *x*-
and *y*-coordinates and the value of each element
as the *z*-coordinate.

`surface(Z) `

plots the
surface specified by the matrix `Z`

. Here, `Z`

is
a single-valued function, defined over a geometrically rectangular
grid. The values in `Z`

can be numeric or datetime
or duration values.

`surface(Z,C) `

plots the
surface specified by `Z`

and colors it according
to the data in `C`

(see "Examples").

`surface(X,Y,Z) `

uses `C`

`=`

`Z`

,
so color is proportional to surface height above the *x*-*y* plane.

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

plots
the parametric surface specified by `X`

, `Y`

,
and `Z`

, with color specified by `C`

.
The values in `X`

, `Y`

, and `Z`

can
be numeric or datetime or duration values.

`surface(x,y,Z)`

, `surface(x,y,Z,C)`

replaces
the first two matrix arguments with vectors and must have ```
length(x)
= n
```

and `length(y) = m`

where ```
[m,n]
= size(Z)
```

. In this case, the vertices of the surface facets
are the triples `(x(j),y(i),Z(i,j))`

. Note that `x`

corresponds
to the columns of `Z`

and `y`

corresponds
to the rows of `Z`

. For a complete discussion of
parametric surfaces, see the `surf`

function.
The values in `x`

, `y`

, and `Z`

can
be numeric or datetime or duration values.

`surface(...'`

follows the * PropertyName*',PropertyValue,...)

`X`

, `Y`

, `Z`

,
and `C`

arguments with property name/property value
pairs to specify additional surface properties. For a description
of the properties, see Primitive
Surface Properties.`surface(ax,...)`

creates the surface in
the axes specified by `ax`

instead of in the current
axes (`gca`

). The option `ax`

can
precede any of the input argument combinations in the previous syntaxes.

`h = surface(...) `

returns
a primitive surface object.

For examples, see Representing a Matrix as a Surface.

Was this topic helpful?