crossprd#
Purpose#
Computes the cross-products (vector products) of sets of 3x1 vectors.
Format#
- z = crossprd(x, y)#
- Parameters:
x (3xK matrix) – each column is treated as a 3x1 vector.
y (3xK matrix) – each column is treated as a 3x1 vector.
- Returns:
z (3xK matrix) – each column is the cross-product (sometimes called vector product) of the corresponding columns of x and y.
Examples#
// First matrix
x = { 10 4,
11 13,
14 13 };
// Second matrix
y = { 3 11,
5 12,
7 9 };
z = crossprd(x, y);
After the above code,
7 -39
z = -28 107
17 -95
Remarks#
The cross-product vector z is orthogonal to both x and y. sumc(x .* z)
and sumc(y .* z)
will be Kx1 vectors, all of whose elements are 0
(except for rounding error).
Source#
crossprd.src