| MATLAB Function Reference | ![]() |
Syntax
C = cross(A,B) C = cross(A,B,dim)
Description
C = cross(A,B)
returns the cross product of the vectors A and B. That is, C = A x B. A and B must be 3-element vectors. If A and B are multidimensional arrays, cross returns the cross product of A and B along the first dimension of length 3.
C = cross(A,B,dim)
where A and B are multidimensional arrays, returns the cross product of A and B in dimension dim . A and B must have the same size, and both size(A,dim) and size(B,dim) must be 3.
Remarks
To perform a dot (scalar) product of two vectors of the same size, use c = dot(a,b).
Examples
The cross and dot products of two vectors are calculated as shown:
a = [1 2 3]; b = [4 5 6];
c = cross(a,b)
c =
-3 6 -3
d = dot(a,b)
d =
32
See Also
| cputime | csc, csch | ![]() |