Matrix Multiplication Help

1 次查看(过去 30 天)
Euan
Euan 2011-11-12
I have 2 matrix. A=[1 2 3], B=[3 4 5 6 7 8]
What id like to do is for every value in A, multiply it by B. So end up with
C = 3 6 9
4 8 12
5 10 15
6 12 18
7 14 21
8 16 24
Any help would be much appreciated. Thanks

采纳的回答

bym
bym 2011-11-12
  2 个评论
Fangjun Jiang
Fangjun Jiang 2011-11-12
Yup! I was stuck with bsxfun() too! +1
David Young
David Young 2011-11-12
+1, yes, but for generality better to use .' in case b is complex.

请先登录,再进行评论。

更多回答(1 个)

David Young
David Young 2011-11-12
bsxfun(@times, A, B.')

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by