필터 지우기
필터 지우기

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 CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by