You can specify which dimension of a quaternion array to take the product of.
Create a 2-by-2-by-2 quaternion array.
A = reshape(quaternion(randn(8,4)),2,2,2);
Find the product of the elements in each page of the array. The length of the first dimension matches size(A,1), the length of the second dimension matches size(A,2), and the length of the third dimension is 1.
Quaternion, specified as scalar, vector, matrix, or multidimensional array
of quaternions.
Example: qProd = prod(quat) calculates the quaternion
product along the first non-singleton dimension of
quat.
Data Types: quaternion
dim — Dimension first non-singleton dimension (default) | positive integer
Dimension along which to calculate the quaternion product, specified as a
positive integer. If dim is not specified,
prod operates along the first non-singleton
dimension of quat.