%% Boundary of 2-D Point Cloud
% Create and plot a set of random 2-D points.

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])

%
% Compute a boundary around the points using the default shrink factor.

k = boundary(x,y);
hold on;
plot(x(k),y(k));

%
% Create a new boundary around the points using a shrink factor of 0.1. The result is a less compact boundary enveloping the points.

j = boundary(x,y,0.1);
hold on;
plot(x(j),y(j));

% Copyright 2015 The MathWorks, Inc.