I'm trying to calculate the rotation (and rotation rate) between coordinate frames, and am unable to convince myself that I am calculating things correctly.
To give the context, I am modelling a satellite, and am trying to work out the rotation rate and direction as measured in the satellite's body frame (I'm fine with the satellite bit, but it's the maths I need to check, hence asking here). For context I'm using MATLAB.
I have a function that can calculate the orientation of the satellite body frame in the inertial (Earth Centred Inertial - ECI) frame. The function gives the satellite's body vectors $ \hat X_s, \hat Y_s, \hat Z_s $, as described in the ECI frame. My understanding is that if these are column vectors, they can be combined in a 3x3 matrix to form a rotation matrix $\mathbf{C_s}$ describing the rotation between the ECI frame and the satellite body frame $$ \mathbf{C_s}(t_n) = \begin{bmatrix} \hat X_s(t_n) & \hat Y_s(t_n)& \hat Z_s(t_n) \end{bmatrix} $$ where $ t_n$ represents each time step I calculate the satellite orientation for. To describe the rotation of the satellite between $\mathbf{C_s}(t_n)$ and $\mathbf{C_s}(t_{n+1})$ I calculate a rotation matrix $\mathbf{R}(t_n)$ by doingthe following: $$ \mathbf{R}(t_n)\mathbf{C_s}(t_n) = \mathbf{C_s}(t_{n+1}) $$ so $$ \mathbf{R}(t_n) = \mathbf{C_s}(t_{n+1}) \mathbf{C_s}(t_n)^{-1} $$ So I now know how the satellite rotates between each state, I can use the MATLAB function dcm2rod (Direction Cosine Matrix to Rodriguez vector) to give me the axis-angle representation of the rotation $ V_r(t_n) $ at each timestep. And by knowing the timestep size I can convert the angle to an angular rate. This gives me the rotation described in the ECI frame, but I want to convert this back into the satellite body frame. My understanding is that if we have a vector described in the ECI frame ($V_{ECI}$) we can say $$ V_{ECI} = V_s * \mathbf{C}_s $$ where $V_s$ is the same vector described in the satellite frame, and $ \mathbf{C}_s$ describes the orientation of the satellite frame as I have described above. Therefore to calculate the vector in the satellite's frame, we right-multiply both sides by the inverse of $ \mathbf{C}_s$, so $$ V_s = V_{ECI}* \mathbf{C}_s^{-1} $$ So now I can calculate the vector about which we have rotated in the satellite frame $V_{r,s}(t_n)$ as $$ V_{r,s}(t_n) = V_{r,ECI}(t_n) * \mathbf{C}_s(t_n)^{-1} $$ There are two main things that I am not sure about:
- Have I calculated what I think I have calculated? I am not sure whether my understanding is correct, and whether I have multiplied the vectors/matrices correctly
- Is there something I have missed when calculating the rotations/rates? What I have done seems intuitive, but I want to make sure there isn't something I have missed.