The dot product is a very common calculation technique in vector mechanics. In mechanical engineering and classical mechanics, vector mechanics is a very prominent tool to calculate various kinds of situations. In this article, we will show you how to calculate the dot products of matrices and vectors with very basic examples below.
How To Use ‘dot()’ Command In MatLab®?
>> a = [4 1 5]; b = [0 1 2]; c = [1 5 3; 1 5 7; 5 5 7]; d = [0 0 3; 0 5 3; 1 1 1]; dot(a,b) dot(c,d) ans = 11 ans = 5 30 37 >>
In the above example, we created two vectors that have the same dimensions that are called ‘a’ and ‘b’ respectively as shown above. Then we created matrices that have the same 3×3 dimensions which are ‘c’ and ‘d’. We calculated the dot products of these matrices and vectors each other. This is simply done by typing the variables inside the dot() command parentheses respectively.
YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!
If you take a look at the first answer as shown above, the answer is an individual integer. In which the same indexed elements are multiplied and added.
The second answer is a vector that includes three elements. The same calculation for vectors done for each column of matrices individually. And the whole results of each column are typed in vector elements respectively.
The use of the dot() command in Matlab® is simple like above. Leave your comments and questions about the dot() command in Matlab® below!
This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®
Your precious feedbacks are very important to us.
Leave a Reply