1 function q = RPY2Quaternion(rpy)
4 phi = DEG2RAD * rpy(1) / 2;
5 theta = DEG2RAD * rpy(2) / 2;
6 psi = DEG2RAD * rpy(3) / 2;
14 q(1) = cphi * ctheta * cpsi + sphi * stheta * spsi;
15 q(2) = sphi * ctheta * cpsi - cphi * stheta * spsi;
16 q(3) = cphi * stheta * cpsi + sphi * ctheta * spsi;
17 q(4) = cphi * ctheta * spsi - sphi * stheta * cpsi;