MATLAB Function Reference |

**Syntax**

**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:

**See Also**

cputime | csc |

© 1994-2005 The MathWorks, Inc.