how can i do Matrix multiplication with 3 matrices

1 回表示 (過去 30 日間)
Azime Beyza Ari
Azime Beyza Ari 2022 年 4 月 10 日
コメント済み: Azime Beyza Ari 2022 年 4 月 11 日
Hello everyone,
I have 3 matrixs with dimensions;
x[36,36] , rij[36,36], and ai[36,1]
i wanna multpily these matrixes and sum each of them. what i want should look like this;
x(1,1)*r(1,1*ai(1)+x(1,2)*r(1,2)*ai(1)+.....+
x(2,1)*r(2,1)*a(2)+x(2,2)*r(2,2)*a(2)+....+
x(36,1)*r(36,1)*a(36)+x(36,36)*r(36,36)*a(36)
i have tried this;
z= sum((x.*rij)*a,'all');
but this is doing this ;
x(1,1)*r(1,1*ai(1)+x(1,2)*r(1,2)*ai(2)+.....+x(2,1)*r(2,1)*a(1)+x(2,2)*r(2,2)*a(2)+....+ x(36,1)*r(36,1)*a(1)+x(36,36)*r(36,36)*a(36)
But this is not i want!
Hope what i want to do is clear!
Thank you in advance!
  2 件のコメント
Walter Roberson
Walter Roberson 2022 年 4 月 10 日
Are you sure that the second indices for r should be calculated in terms of ai(1) ?
x(1,1)*r(1,1*ai(1)+x(1,2)*r(1,2)*ai(1)+.....+
^^^^
Notice that you did not close the ) after r(1,1
x(2,1)*r(2,1)*a(2)+x(2,2)*r(2,2)*a(2)+....+
Notice that you do close the ) after r(2,1) .
Azime Beyza Ari
Azime Beyza Ari 2022 年 4 月 10 日
編集済み: Azime Beyza Ari 2022 年 4 月 10 日
Sorry for that, it is a typo. It should be closed.

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

採用された回答

Bruno Luong
Bruno Luong 2022 年 4 月 10 日
sum(x.*rij,2)' * ai
  1 件のコメント
Azime Beyza Ari
Azime Beyza Ari 2022 年 4 月 11 日
Thank you! This was what I needed.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by