# How can I determine a rotation matrix from unit vectors?

I want to determine the rotation matrix from which compute the Euler Angles to rotate my spacecraft in order to point in a specific direction. For example, i want the z body axis of the spacecraft to be alligned with the sun vector. Therefore, I've calculated the 3 unit vectors (x,y,z) of my "pointed to the Sun" body coordinate system in an ECEF reference frame. At this point, I've used those unit vectors to write the following rotation matrix: First of all, is this correct? If yes, this matrix allows to rotate a generic vector from ECEF to Body or from Body to ECEF? If not, what do you suggest? Thanks in advance!

• Does this answer your question? math.stackexchange.com/questions/180418/… Sep 22, 2022 at 16:47
• @Frank if you find an answer among all of those linked in Math SE that works best for you, you can post an answer here and explain which one you chose and why it works best for you (and include the bits that actually answer this question).
– uhoh
Sep 22, 2022 at 19:38
• Unfortunately, I already read that page and none of those answered my question. To be more specific, I need to transform the unit vectors that I have in Euler Angles (with a 123 sequence in a Fixed Coordinate System) and provide them to STK in a .a file. However there are a lot of theories out there a none of them works for now. Sep 26, 2022 at 9:39 