This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Triangular surface plot


h = trisurf(...)


trisurf(Tri,X,Y,Z,C) displays triangles defined in the m-by-3 face matrix Tri as a surface. Each row of Tri defines a single triangular face by indexing into the vectors or matrices that contain the X, Y, and Z vertices. The color is defined by the vector C.

trisurf(Tri,X,Y,Z) uses C=Z so color is proportional to surface height.

trisurf(TR) displays the triangles in a triangulation representation. It uses C = TR.Points(:,3) to make sure the surface color is proportional to height.

trisurf(...'PropertyName',PropertyValue...) specifies additional patch property names and values for the patch graphics object created by the function.

h = trisurf(...) returns a patch handle.


collapse all

Create vertex vectors and a face matrix, then create a triangular surface plot.

[x,y] = meshgrid(1:15,1:15);
tri = delaunay(x,y);
z = peaks(15);

If the surface is in the form of a triangulation representation, you can pass it to trisurf alone:

tr = triangulation(tri,x(:),y(:),z(:));

Extended Capabilities

Introduced before R2006a