3D matrix multiplications

2 次查看(过去 30 天)
Alexandra
Alexandra 2016-4-26
Hi,
I have a A(nxa) matrix and a B(1xp) matrix. I'm trying to multiplicate A by B, creating a C(nxaxp) matrix (3D), where the reality nxa is multiplied by each value of p, creating p realities.
Any direct/efficient way of doing this without the for loop?
Thank you very much,

回答(1 个)

Andrei Bobrov
Andrei Bobrov 2016-4-26
C = bsxfun(@times,A,reshape(B,1,1,[]));

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by