This is an expected behavior in Aerospace Toolbox 2.2(R2008b) in the way the quaternion to rotational angle conversion is executed.
When a call is made to QUAT2ANGLE, q is normalized internally using the QUATNORMALIZE function. The input q is changed to qin (q/norm(q)).
However, when a call is made using the ANGLE2QUAT to reconvert the rotational angles back to quaternions, the denormalization is not done. Hence, the output 'q' is does not appear same as input 'q' but it is actually the normalized version of 'q' (qin).
As a workaround, one can denormalize the ouput to match the input.
q=[1 0 1 0];
[yaw, pitch, roll] = quat2angle(q)
q2 = angle2quat(yaw, pitch, roll)
q3 = q2*norm(q);
Output (q3) is now [1 0 1 0] , same as the input (q) was [1 0 1 0].
Best Answer