English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Two vectors a = (a1, a2, …, an) and b = (b1, b2, …, bn) is given by the following formula:
ab = ∑(ai.bi)
UsingdotThe function calculates the dot product of two vectors a and b.
dot(a, b);
Create a script file using the following code-
v1 = [2 3 4]; v2 = [1 2 3]; dp = dot(v1, v2); disp('Dot Product:'); disp(dp);When running the file, it displays the following result-
Dot Product: 20