MATLAB Function Reference
  Go to function:
    Search    Help Desk 
cross    Examples

Vector cross product

Syntax

Description

W = cross(U,V) returns the cross product of the vectors U and V. That is,
W = U x V. U and V are usually 3-element vectors. If U and V are multidimensional arrays, cross returns the cross product of U and V along the first dimension of length 3.

If U and V are arrays, cross(U,V) treats the first size 3 dimension of U and V as vectors, returning pages whose columns are cross products.

W = cross(U,V,dim) where U and V are multidimensional arrays, returns the cross product of U and V in dimension dim . U and V must have the same size, and both size(U,dim) and size(V,dim) must be 3.

Remarks

To perform a dot (scalar) product of two vectors of the same size, use:

c = sum(a.*b) or, if a and b are row vectors, c = a.'*b.

Examples

The cross and dot products of two vectors are calculated as shown:



[ Previous | Help Desk | Next ]