meb
Computes the smallest enclosing ball of a point set.
Syntax
[c,r] = meb(A)
[c,r] = meb(A,dim)
[c,r,s] = meb(...)
Inputs
- A
- The matrix of point coordinates.
- dim
- The dimension of A that contains the points.
Outputs
- c
- The center of the minimum enclosing ball.
- r
- The radius of the minimum enclosing ball.
- s
- The support set of the minimum enclosing ball.
Example
Find and plot the smallest enslosing circle for a set of random points.
rand('seed', 2013);
x = unifrnd(10,20,10,1);
y = unifrnd(10,20,10,1);
scatter(x, y);
[c,r,s] = meb([x,y], 2)
hold on;
theta = [0:2:360]*(pi/180);
xc = c(1) + r * cos(theta);
yc = c(2) + r * sin(theta);
plot(xc, yc);
xlim([9,21]);
ylim([8,20]);
plot(c(1),c(2));
Comments
The algorithm works for points with any number of dimensions.