www.gusucode.com > pde 案例源码 matlab代码程序 > pde/GeometryFromConvexHullExample.m
%% Geometry from Convex Hull % Create a geometric block from the convex hull of a mesh grid of points. %% % Create a 3-D mesh grid. [x,y,z] = meshgrid(-2:4:2); %% % Create the convex hull. x = x(:); y = y(:); z = z(:); K = convhull(x,y,z); %% % Put the data in the correct shape for |geometryFromMesh|. nodes = [x';y';z']; elements = K'; %% % Create a PDE model and import the mesh. model = createpde(); geometryFromMesh(model,nodes,elements); %% % View the geometry and face numbers. pdegplot(model,'FaceLabels','on','FaceAlpha',0.5)