function R = Rzyx(phi,theta,psi) % R = Rzyx(phi,theta,psi) computes the Euler angle rotation matrix R % in SO(3) using the zyx convention % % Author: Thor I. Fossen % Date: 14th June 2001 % Revisions: cphi = cos(phi); sphi = sin(phi); cth = cos(theta); sth = sin(theta); cpsi = cos(psi); spsi = sin(psi); R = [... cpsi*cth -spsi*cphi+cpsi*sth*sphi spsi*sphi+cpsi*cphi*sth spsi*cth cpsi*cphi+sphi*sth*spsi -cpsi*sphi+sth*spsi*cphi -sth cth*sphi cth*cphi ];