Possibility of multidimensional arrays multiplication

1 回表示 (過去 30 日間)
Juraj
Juraj 2013 年 11 月 20 日
回答済み: Azzi Abdelmalek 2013 年 11 月 20 日
Hello,
is there a way to perform a matrix multiplication with multidimensional arrays without using a loop? Specifically, I have a 3-dimensional array A_ijk that I want to multiply with a vector b_k in such a way, that the result is a 2D matrix B_ij=A_ijk*b_k, where I sum over k.
I know how to do this using a loop, but I would like to do it in a different way, analogous to matrix multiplication because of effectivness and time consumed (the matrixes are quite big). Thanks in advance, Juraj

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 20 日
sum(bsxfun(@times,A,b),3)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by