3D matrix multiplications

2 vues (au cours des 30 derniers jours)
Alexandra
Alexandra le 26 Avr 2016
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,

Réponses (1)

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

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by