Matrix Multiplication column and vector
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to solve this problem:
A is 1 column of 100k results; B is a vector of 10 weights; I need a matrix of 10 columns and 100k rows:
[(result line 1)*W1 (result line 1)*W2 (result line 2)*W1 (result line 2)*W2 ...
Thank you very much,
1 个评论
Torsten
2015-8-3
I don't understand the logic behind
[(result line 1)*W1 (result line 1)*W2 (result line 2)*W1 (result line 2)*W2 ...
Could you explain ?
Best wishes
Torsten.
采纳的回答
更多回答(1 个)
Lukas Bystricky
2015-8-3
Try
B*A
where A is a row vector and B is a column vector (you may need to transpose them to get them in this form). That will give a matrix with length(B) rows and length(A) columns.
2 个评论
Lukas Bystricky
2015-8-3
编辑:Lukas Bystricky
2015-8-3
The first vector has to be a column vector and the second a row vector, otherwise the multiplication isn't defined. You can turn a row vector into a column vector (or vice versa) by using
A = A'
for example.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!