MATLAB: How to create a mesh surface from given 3D coordinates

3dmeshplotsurface

Hi all,
I've decided to give MATLAB a try for my research project.
I'm trying to create a 3D mesh of given coordinates E, N and elevation.
I can plot all the points using plot3(x,y,z,'.');
Using an XLSX or csv spreadsheet for the datsets I have removed all unnecessary data such as point name and code leaving only E,N and elevation in a 460×3 table.
And using the patch function it does something but not creating the surface as I would like it as a mesh.
I would also like to set some parameters when creating the mesh i.e don't create surface between outside points where distance between those points is greater than say 20m.
Attached is a screenshot of where I am up to.
Kind regards,
Mitch.

Best Answer

Two options:
%%structured
xi = unique(x) ; yi = unique(y) ;
[X,Y] = meshgrid(xi,yi) ;
Z = reshape(z,size(X)) ;
figure
surf(X,Y,Z)
%%unstructured
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
figure
trisurf(tri,x,y,z)