Borrar filtros
Borrar filtros

Matrix multiplication and trace can any body help me

1 visualización (últimos 30 días)
vikas Kumar
vikas Kumar el 24 de Ag. de 2020
Editada: Matt J el 24 de Ag. de 2020
Hi,
I have a A(5X5) matrix and a B(5X5X10) matrix. I want to compute Trace(A*B(:,:,1))+Trace(A*B(:,:,2)) +…+Trace(A*B(:,:,10))
Any direct/efficient way of doing this without the for loop?
Thank you very much,

Respuestas (1)

Matt J
Matt J el 24 de Ag. de 2020
Editada: Matt J el 24 de Ag. de 2020
result=sum( A.'.*sum(B,3) ,'all')

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by