Index Page
cspice_vhat
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   CSPICE_VHAT returns the unit vector along a double precision
   3-dimensional vector.

I/O


   Given:

      v1   is an arbitrary vector(s).

           [3,n] = size(v1); double = class(v1)

   the call:

      vout = cspice_vhat(v1)

   returns:

      vout   contains the unit vector(s) in the direction of 'v1'.

             [3,n] = size(vout); double = class(vout)

                   ^       --
                 vhat =    v1
                        --------
                           --
                        || v1 ||

                      _                                               _
             where || x || indicates the Euclidean norm of the vector x.

             If 'v1' represents the zero vector, then 'vout' will
             also be the zero vector.

             'vout' returns with the same vectorization measure, N,
             as 'v1'.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

      >> v1 = [ 5; 12; 0]

      v1 =

           5
          12
           0

      >> cspice_vhat(v1)

   MATLAB outputs:

      ans =

          0.3846
          0.9231
               0

      >> v2 = [ 1D-7; 2D-7; 2D-7]

      v2 =

         1.0e-06 *

          0.1000
          0.2000
          0.2000

      >> cspice_vhat(v2)

   MATLAB outputs:

      ans =

          0.3333
          0.6667
          0.6667

      >> v = [v1, v2 ]

      v =

          5.0000    0.0000
         12.0000    0.0000
               0    0.0000

      >> cspice_vhat(v)

   MATLAB outputs:

      ans =

          0.3846    0.3333
          0.9231    0.6667
               0    0.6667

Particulars


   None.

Required Reading


   For important details concerning this module's function, please refer to
   the CSPICE routine vhat_c.

   MICE.REQ

Version


   -Mice Version 1.0.2, 18-DEC-2014, EDW (JPL)

       Edited I/O section to conform to NAIF standard for Mice documentation.

   -Mice Version 1.0.1, 30-DEC-2008, EDW (JPL)

      Corrected misspellings.

   -Mice Version 1.0.0, 25-APR-2006, EDW (JPL)

Index_Entries


   unitize a 3-dimensional vector


Wed Apr  5 18:00:36 2017