How can I multiply N dimensional matrices

32 ビュー (過去 30 日間)
Zoja Selimi
Zoja Selimi 2020 年 7 月 16 日
コメント済み: James Tursa 2020 年 9 月 17 日
I am trying to multiply a 3x3xn matrix with a 3x4xn matrix.
I tried a for loop but it says that the matrix dimensions do not agree.
The new matrix that I need is just the product of the first A(:,:,i)*B(:,:,i) which should work but in my case it isn't

採用された回答

KSSV
KSSV 2020 年 7 月 16 日
C = zeros(3,4,n) ;
for i = 1:n
C(:,:,i) = A(:,:,i)*B(:,:,i) ;
end

その他の回答 (2 件)

James Tursa
James Tursa 2020 年 7 月 16 日
編集済み: James Tursa 2020 年 7 月 16 日

Steven Lord
Steven Lord 2020 年 9 月 17 日
See the pagemtimes function introduced in release R2020b.
  1 件のコメント
James Tursa
James Tursa 2020 年 9 月 17 日
Finally! Guess I can now stop worrying about updating MTIMESX.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by