How do I multiply vector elements in the following fashion???

1 次查看(过去 30 天)
Suppose I have A=[18 44 20 55] & B=[4 6]
Now I want C=[18*4 44*4 20*6 55*6]
i.e I want to multiply first element of B with first pair of elements in A
and second element of B with second pair of A and so on...

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2016-4-2
编辑:Azzi Abdelmalek 2016-4-2
A=[18 44 20 55]
B=[4 6]
out=reshape(bsxfun(@times,A',B),1,[])
  3 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by