I need to find the roll, pitch an yaw rotation to point a satellite to a precise point on Earth. I know the satellite position and velocity in ECEF coordinates, the position of the site on Earth (also in ECEF) and therefore the range vector from the site to the satellite.

With those information I've already computed the azimuth and elevation of the satellite with respect the site and I can transform the range vector from ECEF coordinates to the satellite body coordinate system (which in this case is the VVLH) but I need a way the yaw, pitch and roll angles to rotate the satellite z axis (which is Nadir pointing) to point to the desired site: in few words, there's a way to compute the angles to rotate the z_nadir unit vector to the unit vector from the satellite to the site?

I've tried to compute the acos of the dot product of the satellite body z-axis with the projection of the range vector in the appropriate body reference planes (ZX for pitch, ZY for roll, XY for yaw) to get the angles but once applied the rotations, the vector which I get is not the exactly the one that I expect.

Then I've tried something like this, and that is solving the following system using MATLAB's fsolve: System I've tried to solve to get the Euler's angle from starting and ending vectors.

However, also in these case the results are not so accurate (there's a 1e-4 error with respect the vector that I want) and furthermore the rotations computed are not consistent with the ones that I expect.

Do you have any suggestion?

Thank you in advance and, if I wasn't clear, I am available for clarifications.


2 Answers 2


If the satellite is initially pointing at [0,0,1] and you want to point it at [x,y,z], there are infinitely many options. Here are the ones that involve only two rotations around the satellite's principal axes, one after the other.

x-axis, then y-axis:

rot_x = atan2(y, z)
rot_y = atan2(x, hypot(y, z))

y-axis, then x-axis:

rot_y = atan2(x, z)
rot_x = atan2(y, hypot(x, z))

z-axis, then y-axis:

rot_z = atan2(y, x)
rot_y = atan2(hypot(y, x), z)

z-axis, then x-axis:

rot_z = atan2(x, y)
rot_x = atan2(hypot(x, y), z)
  • $\begingroup$ Hi, what do you suggest in case I want to determine the rot_z first, then rot_y and after that rot_x? $\endgroup$
    – Frank
    Commented Sep 22, 2022 at 15:11
  • $\begingroup$ @Frank - Isn't the body-z-axis the optical axis of your satellite? You can rotate around that axis arbitrarily and it still points in the same direction as before. $\endgroup$
    – Rainer P.
    Commented Sep 22, 2022 at 15:38

I think I've found a solution and I beg your pardon if I ask questions and answer myself but maybe someone can run into the same problem.

Given s as the vector which points from the satellite to the point on Earth and assuming a yaw angle equal to 0°, it can be used the following equation to compute pitch:

pitch = atan(sx/sz)

Once determined pitch, you need to apply to s a type 2 rotation (with an angle=-pitch) obtaining the vector s' and therefore it is possible to compute roll with an equation similar to the one shown above:

roll = atan(s'y/s'z)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.