フィルターのクリア

Matrix multiplication and trace can any body help me

1 回表示 (過去 30 日間)
vikas Kumar
vikas Kumar 2020 年 8 月 24 日
編集済み: Matt J 2020 年 8 月 24 日
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,

回答 (1 件)

Matt J
Matt J 2020 年 8 月 24 日
編集済み: Matt J 2020 年 8 月 24 日
result=sum( A.'.*sum(B,3) ,'all')

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by