Cart2Sph:

Path: Common/Transform

% Converts cartesian coordinates to spherical.

--------------------------------------------------------------------------
   Form:
   [r, theta, phi] = Cart2Sph( x, y, z )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   x                     (:,:)  Either x or [x;y;z]
   y                     (:)    y
   z                     (:)    z

   -------
   Outputs
   -------
   r                     (:,:)  r or [r;theta;phi] (r is vector magnitude)
   theta                 (:)    theta (angle in xy-plane)
   phi                   (:)    phi (angle measured from z axis to xy plane)

--------------------------------------------------------------------------

Back to the Common Module page