08-Jan-2022 08:01:01 quaternions_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test quaternions() degrees_to_radians_test(): DEGREES_TO_RADIANS converts an angle from degrees to radians; Degrees Radians Degrees -60.000000 -1.047198 -60.000000 -30.000000 -0.523599 -30.000000 0.000000 0.000000 0.000000 30.000000 0.523599 30.000000 60.000000 1.047198 60.000000 90.000000 1.570796 90.000000 120.000000 2.094395 120.000000 150.000000 2.617994 150.000000 180.000000 3.141593 180.000000 210.000000 3.665191 210.000000 240.000000 4.188790 240.000000 270.000000 4.712389 270.000000 300.000000 5.235988 300.000000 330.000000 5.759587 330.000000 360.000000 6.283185 360.000000 390.000000 6.806784 390.000000 420.000000 7.330383 420.000000 q8_conjugate_test(): q8_conjugate() conjugates a quaternion; q1 = q8_normal_01 ( ): 0.531253 -0.357188 1.73803 -1.05195 q2 = q8_conjugate ( q1 ): 0.531253 0.357188 -1.73803 1.05195 q1 = q8_normal_01 ( ): 0.783148 0.550703 -1.53009 -0.464218 q2 = q8_conjugate ( q1 ): 0.783148 -0.550703 1.53009 0.464218 q1 = q8_normal_01 ( ): 0.287552 -0.064487 1.88958 -0.353167 q2 = q8_conjugate ( q1 ): 0.287552 0.064487 -1.88958 0.353167 q1 = q8_normal_01 ( ): -0.294648 0.027151 0.419369 0.519342 q2 = q8_conjugate ( q1 ): -0.294648 -0.027151 -0.419369 -0.519342 q1 = q8_normal_01 ( ): 1.13411 -0.663653 0.660554 -0.171849 q2 = q8_conjugate ( q1 ): 1.13411 0.663653 -0.660554 0.171849 q8_exponentiate_test(): Q8_EXPONENTIATE exponentiates a quaternion; q1 = q8_normal_01 ( ): 0.895654 0.204412 0.523431 -0.230451 q2 = q8_exponentiate ( q1 ): 2.01098 0.470378 1.20448 -0.530297 q1 = q8_normal_01 ( ): 0.0427978 -0.879328 -0.600541 0.482817 q2 = q8_exponentiate ( q1 ): 0.408001 -0.722516 -0.493445 0.396716 q1 = q8_normal_01 ( ): 0.436772 0.80871 0.817722 0.16577 q2 = q8_exponentiate ( q1 ): 0.61527 0.988403 0.999418 0.202604 q1 = q8_normal_01 ( ): 1.53555 0.458399 0.961696 -1.93352 q2 = q8_exponentiate ( q1 ): -2.76138 0.77528 1.62649 -3.27012 q1 = q8_normal_01 ( ): -0.349201 0.778613 0.312106 0.0686242 q2 = q8_exponentiate ( q1 ): 0.469867 0.486547 0.195031 0.0428825 q8_inverse_test(): Q8_INVERSE inverts a quaternion; q1 = q8_normal_01 ( ): -0.944277 0.869493 0.204833 -0.701749 q2 = q8_inverse ( q1 ): -0.432741 -0.398469 -0.0938704 0.321596 q3 = q8_multiply ( q1, q2 ): 1 0 0 5.55112e-17 q1 = q8_normal_01 ( ): -1.82779 0.117711 -0.771 -1.01108 q2 = q8_inverse ( q1 ): -0.367661 -0.0236778 0.155088 0.20338 q3 = q8_multiply ( q1, q2 ): 1 0 -6.93889e-18 0 q1 = q8_normal_01 ( ): 0.0243999 -0.828357 -0.685888 -1.45055 q2 = q8_inverse ( q1 ): 0.00748166 0.253996 0.210311 0.444776 q3 = q8_multiply ( q1, q2 ): 1 0 0 -1.56125e-17 q1 = q8_normal_01 ( ): 0.480018 0.784553 -2.06321 0.0212085 q2 = q8_inverse ( q1 ): 0.0940613 -0.153736 0.404295 -0.00415588 q3 = q8_multiply ( q1, q2 ): 1 1.21431e-17 -4.77049e-18 1.0842e-17 q1 = q8_normal_01 ( ): -0.15419 0.241667 0.169548 1.02109 q2 = q8_inverse ( q1 ): -0.133665 -0.209499 -0.146979 -0.885173 q3 = q8_multiply ( q1, q2 ): 1 0 0 0 q8_multiply_test(): Q8_MULTIPLY multiplies two quaternions; q1 = q8_normal_01 ( ) : -0.0242077 0.755911 -0.367152 -1.10806 q2 = q8_normal_01 ( ) : 0.465027 -0.121608 0.707242 0.84002 q3 = q8_multiply ( q1, q2 ): 1.27113 0.829718 -0.688088 -0.0456512 q1 = q8_normal_01 ( ) : -0.0919728 1.94813 -0.0158474 0.588854 q2 = q8_normal_01 ( ) : 0.0260714 0.640477 -0.225118 0.309915 q3 = q8_multiply ( q1, q2 ): -1.43619 0.119534 -0.206317 -0.441562 q1 = q8_normal_01 ( ) : -0.012283 1.80363 -0.970483 0.164424 q2 = q8_normal_01 ( ) : 0.70308 -1.26327 -0.984971 -0.318146 q3 = q8_multiply ( q1, q2 ): 1.36625 1.75432 -0.304124 -2.88299 q1 = q8_normal_01 ( ) : -0.0928375 0.405283 0.0174735 -0.74562 q2 = q8_normal_01 ( ) : -1.26593 -0.574671 2.14186 0.755194 q3 = q8_multiply ( q1, q2 ): 0.876093 1.1505 -0.0985459 1.75189 q1 = q8_normal_01 ( ) : 0.20511 -1.10665 0.253103 0.269209 q2 = q8_normal_01 ( ) : -1.04266 0.203039 -1.54942 2.54193 q3 = q8_multiply ( q1, q2 ): -0.281315 2.256 2.28599 1.90396 q8_multiply2_test(): Q8_MULTIPLY2 multiplies two quaternions using a matrix; q1 = q8_normal_01 ( ) : 0.523901 -1.83401 -1.50343 -0.272459 q2 = q8_normal_01 ( ) : -1.5201 -1.13361 -0.926503 -1.34648 q3 = q8_multiply2 ( q1, q2 ): -4.63522 3.9659 -0.360627 -0.296341 q1 = q8_normal_01 ( ) : -0.0100201 -0.862731 1.09166 0.63474 q2 = q8_normal_01 ( ) : 1.46873 -0.889442 0.889506 -1.72382 q3 = q8_multiply2 ( q1, q2 ): -0.658924 -3.70463 -0.457325 1.15309 q1 = q8_normal_01 ( ) : 1.11256 -0.0270253 -2.11292 0.795704 q2 = q8_normal_01 ( ) : 2.0554 -0.501687 0.511049 -3.23843 q3 = q8_multiply2 ( q1, q2 ): 5.92983 5.8222 -4.26104 -3.04129 q1 = q8_normal_01 ( ) : 0.431018 -0.466598 -1.79699 1.30934 q2 = q8_normal_01 ( ) : 0.507982 -1.56112 1.09764 -0.690335 q3 = q8_multiply2 ( q1, q2 ): 2.36686 -1.10656 -2.80588 -2.94989 q1 = q8_normal_01 ( ) : -0.15993 1.83946 1.28845 1.48139 q2 = q8_normal_01 ( ) : -0.464296 -0.254128 0.670583 0.864003 q3 = q8_multiply2 ( q1, q2 ): -1.60223 -0.693581 -2.67123 0.734954 q8_norm_test() q8_norm() computes the norm of a quaternion. q = q8_normal_01(): -0.406005 -0.391252 -1.44213 -0.120334 q8_norm(q) = 1.5531 q = q8_normal_01(): 1.19946 0.620362 1.20732 1.18208 q8_norm(q) = 2.16298 q = q8_normal_01(): 0.1161 1.83662 1.25832 0.405833 q8_norm(q) = 2.26599 q = q8_normal_01(): 0.425479 -0.153825 -1.19025 0.0804972 q8_norm(q) = 1.27588 q = q8_normal_01(): 1.19235 -0.865674 1.08082 0.907974 q8_norm(q) = 2.0405 q8_normal_01_test() Q8_NORMAL_01 computes a normally distributed quaternion. Sample #1 -0.542065 0.449936 -1.38736 0.956776 Sample #2 1.46082 1.59479 0.332491 -0.0940327 Sample #3 0.978369 0.385797 -1.02779 1.35715 Sample #4 0.62475 0.0606545 1.22235 2.1904 Sample #5 -0.10653 -0.923548 -0.887985 0.282837 q8_transpose_print_test() q8_transpose_print() prints a quaternion "transposed", that is, writing it as a row vector. The quaternion: -0.315199 1.05225 0.287339 0.712041 radians_to_degrees_test(): RADIANS_TO_DEGREES converts an angle from radians to degrees; Degrees Radians Degrees -60.000000 -1.047198 -60.000000 -30.000000 -0.523599 -30.000000 0.000000 0.000000 0.000000 30.000000 0.523599 30.000000 60.000000 1.047198 60.000000 90.000000 1.570796 90.000000 120.000000 2.094395 120.000000 150.000000 2.617994 150.000000 180.000000 3.141593 180.000000 210.000000 3.665191 210.000000 240.000000 4.188790 240.000000 270.000000 4.712389 270.000000 300.000000 5.235988 300.000000 330.000000 5.759587 330.000000 360.000000 6.283185 360.000000 390.000000 6.806784 390.000000 420.000000 7.330383 420.000000 rotation_axis_vector_test(): ROTATION_AXIS_VECTOR applies an axis rotation to a vector; The vector: 1: 1 2: 4 3: 10 The rotation axis: 1: 0.236174 2: -0.881412 3: -0.409065 The rotation angle is 1.159804 The rotated vector: 1: -7.22724 2: 2.9641 3: 7.48205 The vector: 1: 1 2: 1 3: 1 The rotation axis: 1: 0 2: 0 3: 2 The rotation angle is 1.570796 The rotated vector: 1: -1 2: 1 3: 1 rotation_axis2mat_test(): ROTATION_AXIS2MAT converts a rotation axis to a matrix. The vector V: 1: 1 2: 4 3: 10 The rotation axis: 1: 0.236174 2: -0.881412 3: -0.409065 The rotation angle is 1.159804 The rotation matrix A: Col: 1 2 3 Row 1 : 0.433013 0.25 -0.866025 2 : -0.5 0.866025 -1.04741e-08 3 : 0.75 0.433013 0.5 The rotated vector W = A * V: 1: -7.22724 2: 2.9641 3: 7.48205 The vector V: 1: 1 2: 1 3: 1 The rotation axis: 1: 0 2: 0 3: 2 The rotation angle is 1.570796 The rotation matrix A: Col: 1 2 3 Row 1 : 6.12323e-17 -1 0 2 : 1 6.12323e-17 0 3 : 0 0 1 The rotated vector W = A * V: 1: -1 2: 1 3: 1 rotation_axis2quat_test(): ROTATION_AXIS2QUAT converts a rotation axis to a quaternion. The vector V: 1: 1 2: 4 3: 10 The rotation axis: 1: 0.236174 2: -0.881412 3: -0.409065 The rotation angle is 1.159804 The rotation quaternion Q: 1: 0.836516 2: 0.129409 3: -0.482963 4: -0.224144 The rotated vector W: 1: -7.22724 2: 2.9641 3: 7.48205 The vector V: 1: 1 2: 1 3: 1 The rotation axis: 1: 0 2: 0 3: 2 The rotation angle is 1.570796 The rotation quaternion Q: 1: 0.707107 2: 0 3: 0 4: 0.707107 The rotated vector W: 1: -1 2: 1 3: 1 rotation_mat_vector_test(): ROTATION_MAT_VECTOR applies a matrix rotation to a vector. The rotation matrix: Col: 1 2 3 Row 1 : 0.433013 0.25 -0.866025 2 : -0.5 0.866025 0 3 : 0.75 0.433013 0.5 The vector V: 1: 1 2: 4 3: 10 The rotated vector W = A * V: 1: -7.22724 2: 2.9641 3: 7.48205 rotation_mat2axis_test() ROTATION_MAT2AXIS computes a rotation axis and angle from a rotation matrix. ROTATION_AXIS2MAT computes a rotation matrix from a rotation axis and angle. The rotation matrix: Col: 1 2 3 Row 1 : 0.433013 0.25 -0.866025 2 : -0.5 0.866025 0 3 : 0.75 0.433013 0.5 The rotation axis: 1: 0.236174 2: -0.881412 3: -0.409065 The rotation angle is 1.159804 The recovered rotation matrix: Col: 1 2 3 Row 1 : 0.433013 0.25 -0.866025 2 : -0.5 0.866025 9.17325e-09 3 : 0.75 0.433013 0.5 rotation_mat2quat_test(): ROTATION_MAT2QUAT computes a quaternion from a rotation matrix. ROTATION_QUAT2MAT computes a rotation matrix from a quaternion. The rotation matrix: Col: 1 2 3 Row 1 : 0.433013 0.25 -0.866025 2 : -0.5 0.866025 0 3 : 0.75 0.433013 0.5 The rotation quaternion Q: 1: 0.836516 2: 0.12941 3: -0.482963 4: -0.224144 The recovered rotation matrix: Col: 1 2 3 Row 1 : 0.433013 0.25 -0.866025 2 : -0.5 0.866025 9.17325e-09 3 : 0.75 0.433013 0.5 rotation_quat_vector_test(): ROTATION_QUAT_VECTOR applies a quaternion rotation to a vector. The rotation quaternion: 1: 0.836516 2: 0.12941 3: -0.482963 4: -0.224144 The vector V: 1: 1 2: 4 3: 10 The rotated vector: 1: -7.22724 2: 2.96409 3: 7.48204 rotation_quat2axis_test(): ROTATION_QUAT2AXIS computes a rotation axis and angle from a rotation quaternion. ROTATION_AXIS2QUAT computes a rotation quaternion from a rotation axis and angle. The rotation quaternion: 1: 0.836516 2: 0.12941 3: -0.482963 4: -0.224144 The rotation axis: 1: 0.236175 2: -0.881412 3: -0.409065 The rotation angle is 1.159805 The recovered rotation quaternion: 1: 0.836516 2: 0.12941 3: -0.482963 4: -0.224144 rotation_quat2mat_test(): ROTATION_QUAT2MAT computes a rotation axis from a rotation quaternion. ROTATION_MAT2QUAT computes a rotation quaternion from a rotation matrix. The rotation quaternion: 1: 0.836516 2: 0.12941 3: -0.482963 4: -0.224144 The rotation matrix: Col: 1 2 3 Row 1 : 0.433012 0.25 -0.866026 2 : -0.500001 0.866025 -5.53776e-07 3 : 0.75 0.433014 0.499999 The recovered rotation quaternion: 1: 0.836516 2: 0.12941 3: -0.482963 4: -0.224144 rotation_xyz_test(): rotation_xyz() rotates an xyz point through an angle of theta radians around an axis vector using quaternion multiplication. The rotation axis: 1: 0.154701 2: -0.577351 3: -0.267949 The rotation angle (degrees): 66.4519 The point xyz: 1: 1 2: 4 3: 10 The rotated point: 1: -7.22725 2: 2.96409 3: 7.48205 quaternions_test(): Normal end of execution. 08-Jan-2022 08:01:01