Filter löschen
Filter löschen

how can i do Matrix multiplication with 3 matrices

2 Ansichten (letzte 30 Tage)
Azime Beyza Ari
Azime Beyza Ari am 10 Apr. 2022
Kommentiert: Azime Beyza Ari am 11 Apr. 2022
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 Kommentare
Walter Roberson
Walter Roberson am 10 Apr. 2022
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 am 10 Apr. 2022
Bearbeitet: Azime Beyza Ari am 10 Apr. 2022
Sorry for that, it is a typo. It should be closed.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Bruno Luong
Bruno Luong am 10 Apr. 2022
sum(x.*rij,2)' * ai

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by