JCart2Sp:

Path: Math/Analysis

% Converts cartesian to spherical coordinates. 
 Spherical coordinates are  defined as[r,theta,phi] where phi is the angle from
 the +z axis and theta is the angle from +x in the xy-plane.

   x = r*cos(theta)*sin(phi)
   y = r*sin(theta)*sin(phi)
   z = r*cos(phi)

   Since version 1.
--------------------------------------------------------------------------
   Form:
   jC = JCart2Sp( c )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   c	            (3,1)  Cartesian coordinates [x, y, z]

   -------
   Outputs
   -------
   jC              (3,3)  Jacobian from cartesian to spherical [r, theta, phi]
                          Phi is zero in the xy plane
                          [     �r/�x     �r/�y     �r/�z ]
                          [ �theta/�x �theta/�y �theta/�z ]
                          [   �phi/�x   �phi/�y   �phi/�z ]

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

Back to the Math Module page