how to multiply quaternion wth 1x3 vector

8 ビュー (過去 30 日間)
zeynep ozkayikci
zeynep ozkayikci 2022 年 8 月 23 日
編集済み: James Tursa 2022 年 8 月 23 日
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)

採用された回答

James Tursa
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 件)

カテゴリ

Help Center および File ExchangeQuaternion Math についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by