$LastChangedDate: 27-Juil-2011 $

# CL_fr_locOrbMat

Inertial frame to custom local orbital frame transformation matrix

## Calling Sequence

       [M] = CL_fr_locOrbMat(pos_car,vel_car,frame_name)

## Description

- Computes the frame transformation matrix M from the inertial reference frame to a custom 'qsw' or 'tnw' local orbital frame.

  The inertial frame is implicitly the frame relative to which the satellite's position and velocity are defined. The local frame is built using these position and velocity vectors.

  frame_name is the name of the local frame. The name is a 3-letter word with letters among the following: 'q', 's', 'w', 't', 'n', lower case or upper case. If 'a' (lower case!) is the name of some axis, 'A' (upper case!) is the name of the same axis in the opposite direction.

  Example: "qWS" means: x-axis = q, y-axis = -w, z-axis = -s

  The reference frame that results should be direct.

- Notes:

  By convention, M multiplied by coordinates relative to the inertial frame yields coordinates relative to the local frame.

- See Local Frames for more details on the definition of local frames.

## Parameters

pos_car:

  satellite's position vector relative to the inertial frame [m] (3xN)

vel_car:

  satellite's velocity vector relative to the inertial frame [m/s] (3xN)

frame_name:

  (string) name of local frame

M :

  inertial to local orbital frame transformation matrix (3x3xN)

## Authors

- CNES - DCT/SB

## See also

- CL_fr_qswMat

- CL_fr_tnwMat

## Examples

    pos_car = [[3500.e3;2500.e3;5800.e3] , [4500.e3;2100.e3;6800.e3]];
    vel_car = [[1.e3;3.e3;7.e3] , [2.e3;3.e3;6.e3]];

    // Example 1: Standard 'qsw' local frame:
    [M] = CL_fr_locOrbMat(pos_car,vel_car,"qsw")
    // is equivalent to:
    [M] = CL_fr_qswMat(pos_car,vel_car)

    // Example 2: 'lvlh': is the same as (s, -w, -q):
    [M] = CL_fr_locOrbMat(pos_car,vel_car,"sWQ")
    // is equivalent to:
    [M] = CL_fr_lvlhMat(pos_car,vel_car)