MATLAB 3D Data Fitting: Find Center & Axes Directions

Click For Summary

Discussion Overview

The discussion revolves around finding the center and axes directions of an ellipsoid that best fits a set of 3D data points with Gaussian noise. Participants explore various mathematical approaches and considerations related to fitting ellipsoids, including the challenges of ensuring the resulting quadric is indeed an ellipsoid rather than other types of quadrics.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant suggests calculating the covariance matrix of the data set and using its eigenvectors and eigenvalues to determine the principal axes and variances, proposing that the mean of the data gives the center.
  • Another participant raises concerns about ensuring the fitted quadric is an ellipsoid and inquires about optimization methods with constraints to avoid non-ellipsoidal fits.
  • A different participant notes that the nature of the quadric is dependent on the sign of the eigenvalues, stating that all eigenvalues must be positive for an ellipsoid and questions how to ensure this condition is met.
  • One participant shares a resource on least squares fitting and discusses the potential for using parametric equations and orthogonal least squares, while also mentioning the complexity added by rotated axes.
  • Another participant expresses uncertainty about the positive definiteness of the covariance matrix, suggesting that if the data is real and three-dimensional, the eigenvalues should be real, and discusses the implications of Gaussian noise on the data distribution.
  • One participant revises their interpretation of the problem, indicating that if the data points are not centered around a specific point, the previous suggestions may not apply.

Areas of Agreement / Disagreement

Participants express differing views on the methods for ensuring the fit is an ellipsoid, with some proposing mathematical approaches while others highlight potential pitfalls. The discussion remains unresolved regarding the best approach to guarantee positive eigenvalues and the implications of data distribution.

Contextual Notes

There are limitations regarding assumptions about the data distribution and the conditions under which the covariance matrix is positive definite. The discussion also reflects uncertainty about the implications of Gaussian noise on the fitting process.

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:

Similar threads

  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
20K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
14K
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
8K