dot
Dot product
Syntax
C = dot(A,B)
C = dot(A,B,dim)
Description
C = dot(
returns thescalar dot productofA,B
)A
andB
.
If
A
andB
are vectors, then they must have the same length.If
A
andB
are matrices or multidimensional arrays, then they must have the same size. In this case, thedot
function treatsA
andB
as collections of vectors. The function calculates the dot product of corresponding vectors along the first array dimension whose size does not equal 1.
Examples
Input Arguments
More About
Algorithms
When inputs
A
andB
are real or complex vectors, thedot
对待他们是列向量和函数dot(A,B)
is the same assum(conj(A).*B)
.When the inputs are matrices or multidimensional arrays, the
dim
argument determines which dimension thesum
function operates on. In this case,dot(A,B)
is the same assum(conj(A).*B,dim)
.
Extended Capabilities
Introduced before R2006a
Was this topic helpful?