3D matrix multiplications

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,

Respuestas (1)

Andrei Bobrov
Andrei Bobrov el 26 de Abr. de 2016

0 votos

C = bsxfun(@times,A,reshape(B,1,1,[]));

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Preguntada:

el 26 de Abr. de 2016

Respondida:

el 26 de Abr. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by