dotDot product
C = dot(A, B)C contains dot products of vectors taken from A and B along the first non-singleton dimension.A and B should have the same sizes, or should be vectors of the same lengths.C = dot(A, B, k)C contains dot products of vectors taken from A and B along the k-th dimension.A and B should have the same sizes.k should be real positive integer scalar.a = randi(3,3,4)
b = randi(3,3,4)
% Dot products of vectors along the first
% non-singleton dimension.
dot(a,b)
% Dot products of vectors along the
% second dimension.
dot(a,b,2)
a =
2.0000 3.0000 3.0000 3.0000
3.0000 2.0000 2.0000 1.0000
2.0000 2.0000 2.0000 3.0000
b =
2.0000 1.0000 1.0000 1.0000
2.0000 1.0000 1.0000 1.0000
2.0000 1.0000 2.0000 3.0000
ans =
14.000 7.0000 9.0000 13.000
ans =
13.000
11.000
19.000