3D surface plot of scattered data

Hello, I have the following data points:

5      1000      0.11
5      8000      0.64
11      27000      1.54
13      27000      1.68
15      27000      1.71
25      64000      2.61
30      64000      2.75
35      64000      2.71
49      125000      3.82
59      125000      3.92
69      125000      3.95
85      216000      4.74
102      216000      5.21
119      216000      5.13
134      343000      4.51
161      343000      4.86
188      343000      5.21

which, as you can see, are scattered. However, if you plot them you'll see that they do form quite a clear surface, which is what I want to plot.

Unfortunately, surf seems to require a uniform grid, and using delaunay creates a load of additional points which looks an absolute mess (if I plot with trisurf). I only want the points defined above to be used in the plot - can this be done in matlab?

Thank you very much!
LVL 25
Who is Participating?
DELAUNEY function does not create additional point, but it may create unneeded triangles (links between non-neighboring nodes).
Looks like you data is sorted by x, y and z, so you can filter triangles between points located far away.

Other methods using GRIDDATA or TriScatteredInterp will indeed generate a lot of additional points.
% triangulation
tri = delaunay(x,y);
% remove triangles with index difference between points > 4
th = 4;
tri( max(abs(diff(tri,[],2)),[],2) > th ,:) = [];
% plot the surface

% you can fix surface color and play with lighting
camlight headlight
lighting phong

Open in new window

InteractiveMindAuthor Commented:
Ah, well that is much better, thank you! Is there a way to disable drawing a border on all of the polygons, but instead draw a single border around the entire shape? (Do you see what I mean?)

Thanks again!
To remove lines you can set EdgeColor property of the patch object:


Draw a single border is harder. Let me think about it.
InteractiveMindAuthor Commented:
Ah well that's actually fine as it is (although if it occurs to you how to do a single border, then I would be interested to know).

Thank you ever so much, you're a life saver!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.