Is there any way to compute a covariance matrix out of a confidence/uncertainty/error ellipse?
I know how it's done the other way around, using a 2x2 covariance matrix
to compute an confidence ellipse (e.g. described here: http://www.visiondummy.com/2014/04/draw-error-ellipse-representing-covariance-matrix/).
Is this even possible or is necessary information missing?
My confidence ellipse is described by the length of both axis and the angle of ellipse rotation.
My approach so far: The axis lengths correspond to the two eigenvalues of the covariance matrix and defining the "spread". An ellipse angle of 0 means, there's no correlation between x & y. Covariance matrix without correlation
I created a new blank 2x2 matrix and assumed the angle is zero
, e.g. I used the first eigenvalue and set it to var_xx
. the same with the second eigenvalue and var_yy
. Now I have a diagonal matrix, which describes the variance, but no rotation (correlation).
Now I used a 2D rotation matrix and the ellipse angle to rotate the previous created matrix.
This approach seems wrong, because the matrix isn't symmetric anymore. Unfortunately a covariance matrix has to be symmetric.
Any ideas?
Daku's answer seems to give nearly the right result, but on the co-variance term there shouldn't be a square on the sin and cosine.
It should be:
varX1 = semiMajorAxis² * cos(phi)² + semiMinorAxis² * sin(phi)²
varX2 = semiMajorAxis² * sin(phi)² + semiMinorAxis² * cos(phi)²
cov12 = (semiMajorAxis² - semiMinorAxis²) * sin(phi) * cos(phi)