MATLAB: Problem with data triangulation

3d scattersurftriangulationtrisurf

Dear Matlab users,
I am trying to visualize a surface made of 3d scattered points. It is not an F(x,y) -> z function, z is just a scalar associated to (x,y) pairs. The x and y pairs form a fairly uniform rectangular grid on the xy plane. However, as soon as I try to use trisurf, the data are triangulated in an unexpected fashion.
I am actually interested in "connecting" these 3d points, not in an interpolation. The surface which can be glimpsed from scatter3 appears to be quite regular, but I wasn't succesfull in using trisurf or even surf.
Can you help me in achieving this goal? I am probably missing something in how the delaunay triangulation works.
Thank you in advance,
Leonardo

Best Answer

It's because of different scales
try to scale your data
dx = max(x)-min(x);
y1 = (y-min(y))/(max(y)-min(y))*dx;
T = delaunay(x,y1);
trisurf(T, x, y, z)
axis vis3d