Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Representing the covariance matrix as an ellipsoid

In general, the covariance matrix can be represented as an error ellipsoid. Since its computation usually involves correlated variables, the matrix can not assumed to be diagonal. That's why we have to figure out the direction of the main axes of the ellipsoid first. The easiest way is to diagonalize the covariance matrix.
cov_diag = X^T cov X
The matrix X contains the eigenvectors of cov, which correspond to the eigenvalues on the diagonal of cov_diag.
So we just take each eigenvector as a main axis of the ellipsoid, with a length given by the corresponding eigenvalue.

In order to draw this shape in the event display, we have to find the angles of rotation of the ellipsoid coordinate system.

Rotations

Rotations in general can be decomposed into three consecutive rotations about the primary axes.
R_x = R1R2R3
In Wired, the choice was made to rotate by an angle omega about the z axis, followed by a rotation by theta about the new x axis, followed by a rotation about phi around the y axis.
The ultimate reference, as usual, is the code, in this case for Matrix3D

In Wired4, the choice of rotation is
R_omega =

cos omega

-sin omega

0

sin omega

cos omega

0

0

0

1

R_theta =

1

0

0

0

cos theta

-sin theta

0

sin theta

cos theta

R_phi =

cos phi

0

sin phi

0

1

0

-sin phi

0

cos phi

We can multiply these entities in the right order to get the combined rotation around all three axes.
The code appears to perform the rotations in the order presented here, so we compute R_phi R_theta R_omega and get

sin(omega) sin(phi) sin(theta) + cos(omega)cos(phi)

cos(omega)sin(phi)sin(theta) - sin(omega)cos(phi)

sin(phi)cos(theta)

sin(omega) cos(theta)

cos(omega)cos(theta)

-sin(theta)

sin(omega) cos(phi)sin(theta) - cos(omega)sin(phi)

cos(omega)cos(phi)sin(theta)+sin(omega)sin(phi)

cos(phi)cos(theta)

In order to find the angles, we have to remember that we want a rotation that gives us the direction of the eigenvectors of cov from the main axes x, y, z. But the eigenvectors are just the columns of X, so R E = X or R=X.
Based on this identity we con simply obtain the angles from the known values of X.
We can choose
theta = -arcsin(X23)
phi = atan(X13/X33)
omega = atan(X12/X22)