MATLAB: How to extract ellipsoid parameter from the conic equation

ellipsoid

Hello
I have a question how do I extract ellipsoid parameter from the conic equation
here is conic equation A*x^2+B*y^2+C*z^2+ 2D*x*y + 2E*x*z + 2F*y*z+2Gx+2Hy+2Iz -1=0
how do I extract the center [x0,y0,z0], the axes lengths [a,b,c], and the rotation angles [ex,ey,ez] of the ellipsoid that it describes. thanks

Best Answer

Rewrite in matrix form
[x-x0,y-y0,z-z0]*Q*([x-x0;y-y0;z-z0])=1
where Q=[A,D,E;D,B,F;E,F,C]. The eigen-decomposition of Q will be
Q=R*diag(1./[a,b,c])*R.'
where columns of the rotation matrix R are the axes of the ellipsoid. You will have to choose between one of many possible decompositions of R into Euler angles [ex,ey,ez]