dot( ) command or function gives the dot or scalar product of vectors or matrices or arrays, after reading this MATLAB dot product topic, you will know the theory and examples.
Syntax:
dot(a,b)
- a and b are two vectors.
Example: To find the dot product of two vectors.
Output:
A = 3 20 34 B = 13 2 3 ans = 181Explanation:
- the dot product of vectors A and B as A.B gives output 3*13+20*2+34*3 = 181.
Example: To find the dot product of two matrices.
Output:
A = 3 20 34 2 3 4 1 2 3 B = 13 2 3 3 4 5 2 6 8 ans = 47 64 146Explanation:
- 47, 64 and 146 are the dot product value of the first, second and third corresponding columns of the matrices A and B.