how can i do Matrix multiplication with 3 matrices

1 visualización (últimos 30 días)
Azime Beyza Ari
Azime Beyza Ari el 10 de Abr. de 2022
Comentada: Azime Beyza Ari el 11 de Abr. de 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 comentarios
Walter Roberson
Walter Roberson el 10 de Abr. de 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 el 10 de Abr. de 2022
Editada: Azime Beyza Ari el 10 de Abr. de 2022
Sorry for that, it is a typo. It should be closed.

Iniciar sesión para comentar.

Respuesta aceptada

Bruno Luong
Bruno Luong el 10 de Abr. de 2022
sum(x.*rij,2)' * ai

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by