MATLAB MATLAB 3D Data Fitting: Find Center & Axes Directions

AI Thread Summary
To find the center and axes of an ellipsoid that best fits a set of noisy 3D samples, calculating the covariance matrix of the data is a recommended approach. The eigenvectors of this matrix indicate the principal axes, while the eigenvalues represent the variances along these axes. To ensure the resulting quadric is an ellipsoid, all eigenvalues must be positive. Concerns arise about fitting non-ellipsoidal shapes, such as hyperboloids, which can occur if eigenvalues are non-positive. Suggestions include using constrained optimization techniques to enforce positive eigenvalues and exploring iterative least squares fitting methods. It is important to clarify whether the data is centered around a specific point or if the center of the ellipsoid is unknown, as this affects the fitting approach.
fenestren
Messages
9
Reaction score
0
Hi.

I have a set of samples with small white gaussian noise that form a small part of an ellissoid in 3D space.
I'm looking for a way to find the center and the axes directions of the ellipsoid that best fits these samples.

This is an overdetermined problem with much more 3d points than unknows: I tried with a least squares such as:

X = [H'*H]\H'*w (the pseudoinverse)

but it doesn't seem to work (I often obtain another not ellipsoidal quadric).

Can you help me, please?

Thanks.
Luca.
 
Physics news on Phys.org
Try calculating the 3x3 covariance matrix of the data set, then find its eigenvectors and eigenvalues. The former are the principal axes, the latter are (I think) the variances along each axis. The square roots of the e-vals will define the ellipsoid. Finding the center is easy: take the mean of the data along each axis.
 
Thank you for your reply.
The problem is avoiding the best fitting quadric to be an hyperboloid or other than an ellipsoid.

Is there a solution for that such as an optimization problem with any constraints?
 
My proposed approach is not a fit.
 
If I'm not wrong, the kind of quadric depends on the sign of eigenvalues and, to have an ellipsoid, they must be all positive, doesn't it?

Is there a way to avoid having non-positive eigenvalues?

Is it maybe possible using a conditioned fitting?

Thank you.
 
Maybe the following link will help:

http://www.geometrictools.com/Documentation/LeastSquaresFitting.pdf

I've dabbled in least squares fitting of 2D conics and found that expressing the equations parametrically and using orthogonal least squares seems to work (iterative approach). If you assume the ellipsoid axes aren't rotated, I'd think the approach would be straightforward (easy to say since I haven't done it!), though even if the axes are rotated the consequence is to add another 3 variables that need to be determined.

http://mathworld.wolfram.com/Ellipsoid.html
 
Last edited:
I think that if your data are real and three-dimensional, then the covariance matrix will be positive definite. (I'm not a mathematician, so I'm not certain.) Assuming that is true, then the eigenvalues are real.

The approach is based on your comment that the points are spread by Gaussian noise. Here is a comment in the Wikipedia article on multivariate Gaussian distributions:

"The equidensity contours of a non-singular multivariate normal distribution are ellipsoids (i.e. linear transformations of hyperspheres) centered at the mean[4]. The directions of the principal axes of the ellipsoids are given by the eigenvectors of the covariance matrix Σ. The squared relative lengths of the principal axes are given by the corresponding eigenvalues."

http://en.wikipedia.org/wiki/Multivariate_normal_distribution"

EDIT: I assumed that your data are centered about a point R in 3D space, and are spread by random noise. The best-fit ellipsoid is centered on R. In re-reading your original post, I see a different possible interpretation--that you have a small sample of noisy data lying on the surface of an ellipsoid whose center is potentially far from R. If this is the case, then my suggestion is not appropriate.
 
Last edited by a moderator:
Back
Top