MATLAB Function Reference | ![]() ![]() |
Syntax
C = dot(A,B) C = dot(A,B,dim)
Description
C = dot(A,B)
returns the scalar product of the vectors A
and B
. A
and B
must be vectors of the same length. When A
and B
are both column vectors, dot(A,B)
is the same as A'*B
.
For multidimensional arrays A
and B
, dot
returns the scalar product along the first non-singleton dimension of A
and B
. A
and B
must have the same size.
C = dot(A,B,dim)
returns the scalar product of A
and B
in the dimension dim
.
Examples
The dot product of two vectors is calculated as shown:
a = [1 2 3]; b = [4 5 6]; c = dot(a,b) c = 32
See Also
![]() | dos | double | ![]() |