How to multiply two rows or columns?

五迷三道 提交于 2019-12-01 22:19:31

You made 2 rows, which can't be multiplied together.

The general form of matrix multiplication is "Row-Dot-Column", which means take the dot product of each row with each column. In your case you have 1 row, but 3 columns (which doesn't work!).

a = [1, 2, 3];
b = [3, 2, 1];
c = a' * b;

ans =

 3     2     1
 6     4     2
 9     6     3

I see now that there is a .* operator. I did not know where to find that in the documentation, and it does what I want.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!