How to fit min. area ellipse around data point

Click For Summary
SUMMARY

This discussion focuses on fitting a minimum area ellipse around 2D data points and an ellipsoid around 3D data points, ensuring that 90% of the data falls within these shapes. The method involves calculating the covariance matrix using the formula R = (1/N)∑(x_n * x_n^T) and deriving the ellipse/ellipsoid equation x^T R x = r^2. The conversation emphasizes the use of MATLAB for implementation, while also inviting suggestions for alternative software that can perform this task efficiently. It is crucial to subtract the mean from the data if it is not negligible to accurately center the ellipse/ellipsoid.

PREREQUISITES
  • Understanding of covariance matrices in statistics
  • Familiarity with MATLAB for data analysis
  • Knowledge of 2D and 3D geometric shapes, specifically ellipses and ellipsoids
  • Basic statistical concepts, including confidence intervals
NEXT STEPS
  • Explore MATLAB functions for covariance matrix calculation
  • Learn about the prctile function in MATLAB for percentile calculations
  • Research alternative software for statistical data visualization, such as Python with NumPy and Matplotlib
  • Investigate methods for data normalization and mean subtraction in data preprocessing
USEFUL FOR

This discussion is beneficial for data scientists, statisticians, and researchers working with 2D and 3D data visualization, particularly those involved in NMR experiments or similar fields requiring statistical shape fitting.

Amrita
Messages
2
Reaction score
0
Hi,

I am having some 2d and 3d data files (from some nmr experiment, as a matter of fact) and the data plot for that is such that most of the points are coming together now I want to draw ellipse around 2d data point and ellipsoid around 3d data point with the condition that 90% (or any confidence interval) of data will fall inside it. Moreover, these ellipse / ellipsoid should have the minimum area/volume. How to do that can anyone advice me?
I have been trying it in Matlab. But if any other software does this efficiently, kindly inform in details.
 
Physics news on Phys.org
Amrita said:
Hi,

I am having some 2d and 3d data files (from some nmr experiment, as a matter of fact) and the data plot for that is such that most of the points are coming together now I want to draw ellipse around 2d data point and ellipsoid around 3d data point with the condition that 90% (or any confidence interval) of data will fall inside it. Moreover, these ellipse / ellipsoid should have the minimum area/volume. How to do that can anyone advice me?
I have been trying it in Matlab. But if any other software does this efficiently, kindly inform in details.
If x1, x2, x3 ... are the column vectors for your points, form the 2×2 or 3×3 covariance matrix

[tex]\textbf{R} = \frac{1}{N}\sum_{n=1}^N \textbf{x}_n \textbf{x}_n^T[/tex]​

The ellipse / ellipsoid you want will have an equation of the form

[tex]\textbf{x}^T\textbf{Rx} = r^2[/tex]​

for some suitable value of r. For arbitrary data you can just calculate the value of rn for each data point x = xn and take the 90th percentile (or whatever).

You should be able to all this in MATLAB.
 
Correction

My response above is based on the assumption that your data has zero mean. If the mean of your data is not negligible (i.e. if you want an ellipse that isn't centred on the origin) you'll need to subtract the mean first before you do anything else.
 

Similar threads

  • · Replies 16 ·
Replies
16
Views
7K
  • · Replies 9 ·
Replies
9
Views
4K
Replies
24
Views
3K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
14
Views
2K