# MATLAB: Angles of line with respect to origin axis in 3D

anglesaxisgeometrymathvectors

There is an point at [xp,yp,zp].
Its origin at [xc,yc,zc].
I need angles of line from [xc,yc,zc] to [xp,yp,zp] with respect to axes of origin as shown below.

gamma = atan(sqrt(((xp-xc)^2+(yp-yc)^2)/(zp-zc));alpha = atan(sqrt(((zp-zc)^2+(yp-yc)^2)/(xp-xc));beta = atan(sqrt(((xp-xc)^2+(zp-zc)^2)/(yp-yc));