## Documentation Center |

3-D shaded surface plot

`surf(Z)surf(Z,C)surf(X,Y,Z)surf(X,Y,Z,C)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.

`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.

`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(...,'PropertyName',PropertyValue)`
specifies surface Surfaceplot along
with the data.

`surf(axes_handles,...)` plots
into the axes with handle `axes_handle` instead of
the current axes (`gca`).

`h = surf(...)` returns a
handle to a Surfaceplot graphics
object.

`axis` | `colormap` | `griddata` | `imagesc` | `mesh` | `meshgrid` | `pcolor` | `scatteredInterpolant` | `shading` | Surfaceplot Properties | `surfc` | `trisurf` | `view`

Was this topic helpful?