MATLAB trisurf

The trisurf function creates a 3D graphic.


Usage

The trisurf function creates a 3D graph based on a triangulation. Such a matrix can be created by convhull, like:

% Create a rectangular grid.
[X,Y,Z] = meshgrid(linspace(-3,3,20), linspace(-3,3,20), linspace(-3,3,20));

% Identify the points within a region of integration.
roi = (X>=0 & X<=sqrt(4-Z.^2-Y.^2)) & (Y>=0 & Y<=sqrt(4-Z.^2) & (Z>=0 & Z<=1));

% Calculate the convex hull of this ROI and plot.
K = convhull(X(roi), Y(roi), Z(roi));
figure;
trisurf(K, X(roi), Y(roi), Z(roi));

See also figures and related commands.

Alternatively, see this example using delaunay:

% Create a grid.
[X,Y] = meshgrid(1:15,1:15);

% Evaluate the peaks function on a 15x15 grid.
Z = peaks(15);

% Triangulate and plot.
T = delaunay(X,Y);
figure;
trisurf(T, X,Y,Z);


CategoryRicottone

MATLAB/TriSurf (last edited 2025-12-17 20:38:41 by DominicRicottone)