(For a little bit of context, I'm working with an attitude-determination algorithm called TRIAD and the software called STK, and I'm trying to make their results consistent.)
Let's say I have this rotation matrix:
BN = [0.7505 0.1707 -0.6384
0.1574 0.8921 0.4236
0.6418 -0.4184 0.6427];
(It could be verified that it has a determinant of 1.)
If I convert it to quaternions with the first component being the scalar,
the result is [0.9063 0.2323 0.3532 0.0037].
However, my desired representation (from the STK output) is [-0.9063 -0.2323 -0.3532 -0.0037].
It could be verified that these two representations yield the same Euler angles using the "quat2eul" function.
What can I do to achieve the desired quaternion representation? The issue isn't as simple as adding a negative sign, because for the rotation matrix,
rotm = [0.8138 0.4698 -0.3420
-0.4410 0.8826 0.1632
0.3785 0.0180 0.9254];
the converted quaternion representation is exactly the same as the desired quaternion representation.
Thanks so much in advance!
Here's a potentially useful reference from STK: