Solved

3D surface plot of scattered data

Posted on 2010-09-10
4
1,119 Views
Last Modified: 2016-03-02
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!
0
Comment
Question by:InteractiveMind
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
yuk99 earned 500 total points
ID: 33648602
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

trisurf(tri,x,y,z);





% you can fix surface color and play with lighting

trisurf(tri,x,y,z,ones(size(tri,1),1));

camlight headlight

lighting phong

Open in new window

0
 
LVL 25

Author Comment

by:InteractiveMind
ID: 33650044
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!
0
 
LVL 15

Expert Comment

by:yuk99
ID: 33650675
To remove lines you can set EdgeColor property of the patch object:

trisurf(tri,x,y,z,'FaceColor','r','EdgeColor','none');

Draw a single border is harder. Let me think about it.
0
 
LVL 25

Author Closing Comment

by:InteractiveMind
ID: 33652760
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!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
my delphi exe application have  problem with windows explorer ! 12 76
no14 challenge 14 57
zeroMAx challenge 20 76
recursion example 16 69
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now