Tong Ka Wai
Tong Ka Wai

Reputation: 1

Major-axis of scatter plot shaped as ellipse in MATLAB

In MATLAB, I have a 2-d scatter plot in (x,y) coordinates that is shaped as an ellipse. How can I obtain the major axis length?

I read somewhere that it has to do with the sqrt of the eigenvalues of the covariance matrix?

Upvotes: 0

Views: 902

Answers (1)

Ander Biguri
Ander Biguri

Reputation: 35525

Indeed, the eigenvectors will give you the mayor and minor axis!

for this scenario, I like better the name computer scientist give to the eigenvalue decomposition: Principal Component analysis. The PCA will output 2 "principal components" or eigenvectors, being these some "new axis". This new axis will be the axis describing better the points, in an ellipsoid, the radii.

The following image shows what I mean. The red vectors are the eingenvectors.

enter image description here

For a step-by-step computation of the thing, check this other answer: Oriented Bounding Box is Misshapen and the Wrong Size in OpenGL

The question is in openGL but the answer in MATLAB. Also, you just need half of the steps, as the other questions asks for a bounding box around the points, for which the OP needed these radii you talk about.

Upvotes: 3

Related Questions