- Matlab Tutorial
- MATLAB - Home
- MATLAB - Overview
- MATLAB - Environment Setup
- MATLAB - Syntax
- MATLAB - Variables
- MATLAB - Commands
- MATLAB - M-Files
- MATLAB - Data Types
- MATLAB - Operators
- MATLAB - Decisions
- MATLAB - Loops
- MATLAB - Vectors
- MATLAB - Matrix
- MATLAB - Arrays
- MATLAB - Colon Notation
- MATLAB - Numbers
- MATLAB - Strings
- MATLAB - Functions
- MATLAB - Data Import
- MATLAB - Data Output
- MATLAB Advanced
- MATLAB - Plotting
- MATLAB - Graphics
- MATLAB - Algebra
- MATLAB - Calculus
- MATLAB - Differential
- MATLAB - Integration
- MATLAB - Polynomials
- MATLAB - Transforms
- MATLAB - GNU Octave
- MATLAB - Simulink
- MATLAB Useful Resources
- MATLAB - Quick Guide
- MATLAB - Useful Resources
- MATLAB - Discussion
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.
dot(a, b);
Example
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
matlab_vectors.htm
Advertisements