1function R = Rzyx(phi,theta,psi)
 2% R = Rzyx(phi,theta,psi) computes the Euler angle
 3% rotation matrix R in SO(3) using the zyx convention
 4%
 5% Author:   Thor I. Fossen
 6% Date:     14th June 2001
 7% Revisions: 
 8
 9cphi = cos(phi);
10sphi = sin(phi);
11cth  = cos(theta);
12sth  = sin(theta);
13cpsi = cos(psi);
14spsi = sin(psi);
15 
16R = [...
17   cpsi*cth  -spsi*cphi+cpsi*sth*sphi  spsi*sphi+cpsi*cphi*sth
18   spsi*cth  cpsi*cphi+sphi*sth*spsi   -cpsi*sphi+sth*spsi*cphi
19   -sth      cth*sphi                  cth*cphi ];