Estimate a Centroid In Arbitrary Dimension

CENTRALIZE is a MATLAB library which estimates the centroid and radius of a shape, or a set of data points, in a space of arbitrary dimension.

We may have been given a way to random sample the shape; we may have been given an organized way to sample; we may have a function that can be evaluated to determine what points belong to the shape. We may already know that the shape is a sphere, ellipse, polytope or convex body. There may be a weight or a weight function associated with points.

The simplest approach estimates the centroid of the shape as the average of the sampled points, and the radius as the average distance of the samples to the estimated centroid. It is interesting to observe the behavior of the error of such an estimate for a fixed number of sample points as the spatial dimension increases.


The computer code and data files made available on this web page are distributed under the GNU LGPL license.


CENTRALIZE is available in a MATLAB version.

Related Programs:

RANDOM_DATA, a MATLAB library which generates sample points for various probability distributions, spatial dimensions, and geometries, including the M-dimensional simplex.

Source Code:

Examples and Tests:

Graphics files created include:

You can go up one level to the MATLAB source codes.

Last revised on 21 May 2013.