Function File: q = quaternion (w)
Function File: q = quaternion (x, y, z)
Function File: q = quaternion (w, x, y, z)
Constructor for quaternions - create or convert to quaternion.
q = w + x*i + y*j + z*kArguments w, x, y and z can be scalars, matrices or n-dimensional arrays, but they must be real-valued and of equal size. If scalar part w or components x, y and z of the vector part are not specified, zero matrices of appropriate size are assumed.
Example
octave:1> q = quaternion (2) q = 2 + 0i + 0j + 0k octave:2> q = quaternion (3, 4, 5) q = 0 + 3i + 4j + 5k octave:3> q = quaternion (2, 3, 4, 5) q = 2 + 3i + 4j + 5koctave:4> w = [2, 6, 10; 14, 18, 22]; octave:5> x = [3, 7, 11; 15, 19, 23]; octave:6> y = [4, 8, 12; 16, 20, 24]; octave:7> z = [5, 9, 13; 17, 21, 25]; octave:8> q = quaternion (w, x, y, z) q.w = 2 6 10 14 18 22 q.x = 3 7 11 15 19 23 q.y = 4 8 12 16 20 24 q.z = 5 9 13 17 21 25 octave:9>
Package: quaternion