MATLAB - Vector Dot Product
Dot product of two vectors a = (a1, a2, …, an) and b = (b1, b2, …, bn) is given by:
a.b = ∑(ai.bi)
Dot product of two vectors a and b is calculated using the dot function.
Create a script file with the following code:
v1 = [2 3 4]; v2 = [1 2 3]; dp = dot(v1, v2); disp('Dot Product:'); disp(dp);
When you run the file, it displays the following result:
Dot Product: 20