MATLAB: How can i plot the convex hull???

convex hull

How can I plot the convex hull(k) in the axes:
net = [1:n;rand([1,n])*x;rand([1,n])*y];
net1 = net;
plot(net(2,:),net(3,:),'bo','MarkerSize',5,'MarkerFaceColor','b');
xx=net(2,:);
yy=net(3,:);
dt = DelaunayTri(xx',yy');
P = [xx',yy'];
[K AV] = convexHull(dt)
I try different plot but they don't work:
%trisurf(K, dt.xx(:,1),dt.xx(:,2),dt.xx(:,3), 'FaceColor', 'cyan')
%plot(dt.xx(K,1),dt.xx(K,2), 'r');
%K =convexHull(dt);
%plot (K,'-.r');
and I have different error message
plz help me

Best Answer

Add this code:
hold on;
plot(xx(K), yy(K), 'r');
and don't use that function, like the help says. It's been deprecated. Use convhull() instead.
Related Question