how to multiply quaternion wth 1x3 vector
2 次查看(过去 30 天)
显示 更早的评论
I have " BECI [3x1] Mag. Field Component vector " ı am trying to multiply with quaternion but it gives dimension error. Should ı change my vector to quaternion. how could ı do?
quatprod = quatmultiply(qb2inv,BECI)
0 个评论
采纳的回答
James Tursa
2022-8-23
编辑:James Tursa
2022-8-23
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];
then
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:
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Quaternion Math 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!