using boundary command from matlab R2015a
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear All,
I'm trying to find the boundary for a set of points for dimension n=>2, so I start with dimension 2. This code is from matlab tool box, why the command boundary doesn't work in my version R2013a or R2014a or R2012b, it gave this answer
Undefined function 'boundary' for input arguments of type 'double'.
I need to find the boundary without using the convhull command even in high dimensions. Can anyone answer me which is the appropriate method and why boundary command doesn't work.
x = gallery('uniformdata',30,1,1);
y = gallery('uniformdata',30,1,10);
plot(x,y,'.')
xlim([-0.2 1.2])
ylim([-0.2 1.2])
k = boundary(x,y);
hold on;
plot(x(k),y(k));
Thanks in advance, Imola.
0 commentaires
Réponses (2)
Walter Roberson
le 7 Juin 2015
Introduced in R2014b
9 commentaires
Walter Roberson
le 10 Juin 2015
Why are you not allowed to use convexhulln? Is this an assignment intended to have you think about how to implement convex hulls yourself? Or is the routine continued to be too expensive? Or is it a patent issue of some kind?
Given a non-convex shape defined only by vertices, what does it mean for a point to be "inside" it or "outside" of it?
Given any finite set of infinitely-small points and any given point in the list, it is always possible to find a viewpoint from "outside" in which the distinguished point is directly visible, not hidden behind some other point. More formally, given any point in the finite list, it is possible to create a ray from the point to infinity that does not intersect any other point in the list. Thus it is always possible to rotate and translate the cloud so that any given point is at the origin and one is looking down to it from "above" and there are no other points in the way to that origin. Project all the other points onto the x-y plane, and you will have a finite set of points "around" the origin. Take the subset of those points that would be "above" the x-y plane from the view and make a surface from those that does not cross the origin, so that the point at the origin is at the bottom of a "well". That is one valid interpretation of what the point cloud "means", that the well was "always there" and you just didn't realize it because you were looking from a direction that was hiding the walls of the well. From this perspective, with that point at the bottom of the well -- the point at the origin, the distinguished point -- is exactly on the surface.
We thus find that given any cloud of points, we can find a perspective and covering in which any given point in the cloud is on the surface of a covering of the cloud.
Now given any particular test point, is it "inside" the cloud or outside of it? Provided the point is not identical to any other point, provisionally add it to the list, rotate and center the right way, establish the covering in which the point would be on the surface. But the point wasn't originally part of the set, so therefore that point must be on the outside. By induction, every test point that is not identical to one of the original points can be shown to be outside of some covering of the cloud.
Unless, that is, you establish rules about how the points have to be connected. The most easily justified of those rules is to declare that the resulting surface must be convex; this is the surface that would be found by convexhulln()... whether you program the routine yourself or use the library routine, imposing the convex requirement gives very clear conditions that are difficult to argue with.
doreminh
le 29 Déc 2017
Modifié(e) : Walter Roberson
le 29 Déc 2017
I tried by this way, it's good,can reply for boundary function:
x = randn(250,1);
y = randn(250,1);
DT = delaunayTriangulation(x,y);
k = convexHull(DT);
n=length(k(:));
for i=1:n
bd(i,1)=x(k(i));
bd(i,2)=y(k(i));
end
figure
fill(bd(:,1),bd(:,2),'r')
hold on
plot(DT.Points(:,1),DT.Points(:,2), '.','markersize',10);
hold on
plot(DT.Points(k,1),DT.Points(k,2),'r')
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!