% Multiplication matrix for quaternions q p = M(q)*p, see PCV (8.45) Usage: M = calc_Mq(q) q - double 4x1, quaternion M - double 4x4, Multiplication matrix for quaternions Wolfgang Förstner wfoerstn@uni-bonn.de See also calc_Mq_comm, calc_R_from_opq_kraus, calc_r_phi_from_R, calc_Rot_ab, calc_Rot_q, calc_Rot_r, calc_Rot_rod, calc_Rot_rp, calc_opq_from_R_Kraus
0001 %% Multiplication matrix for quaternions 0002 % q p = M(q)*p, see PCV (8.45) 0003 % 0004 % Usage: 0005 % M = calc_Mq(q) 0006 % 0007 % q - double 4x1, quaternion 0008 % 0009 % M - double 4x4, Multiplication matrix for quaternions 0010 % 0011 % Wolfgang Förstner 0012 % wfoerstn@uni-bonn.de 0013 % 0014 % See also calc_Mq_comm, calc_R_from_opq_kraus, calc_r_phi_from_R, 0015 % calc_Rot_ab, calc_Rot_q, calc_Rot_r, calc_Rot_rod, calc_Rot_rp, 0016 % calc_opq_from_R_Kraus 0017 0018 function M = calc_Mq(q) 0019 0020 a = q(1); 0021 b = q(2); 0022 c = q(3); 0023 d = q(4); 0024 0025 M=[ a -b -c -d; ... 0026 b a -d c; ... 0027 c d a -b; ... 0028 d -c b a 0029 ];