Effacer les filtres
Effacer les filtres

Matrix multiplication and trace can any body help me

1 vue (au cours des 30 derniers jours)
vikas Kumar
vikas Kumar le 24 Août 2020
Modifié(e) : Matt J le 24 Août 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,

Réponses (1)

Matt J
Matt J le 24 Août 2020
Modifié(e) : Matt J le 24 Août 2020
result=sum( A.'.*sum(B,3) ,'all')

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by