how can i do Matrix multiplication with 3 matrices

2 次查看(过去 30 天)
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by