how to multiply quaternion wth 1x3 vector
3 views (last 30 days)
James Tursa on 23 Aug 2022
Edited: James Tursa on 23 Aug 2022
Use BECI as the "vector" part of a quaternion and put a 0 in the "scalar" part, and use that new quaternion in the multiply. Since MATLAB stores the "scalar" part as the 1st element of the quaternion, that means your new 1x4 quaternion will have a 0 in the 1st spot. E.g., assuming BECI is 1x3 you would have:
QBECI = [0,BECI];
quatprod = quatmultiply(qb2inv,QBECI)
quatmultiply( ) should be smart enough to do this on its own, but it isn't. You could also write a little function to do this in the background for you which would then in turn call quatmultiply( ).
If this is part of a rotation multiply sequence such as q^-1 * v * q or q * v * q^-1, then again start with [0,v] instead of just v, and then pick off the vector part of the final result (the last three elements). The scalar part of the result will probably not be exactly 0 because of floating point arithmetic effects, but this can be ignored.
You might be insterested in this post also: