Multiplying m*m*N matrix internally

조회 수: 2 (최근 30일)
voxynn
voxynn 2018년 1월 11일
댓글: voxynn 2018년 1월 11일
I have a matrix A with dimensions 2*2*N, and I would like to multiply each 2*2 'slice' of the matrix together to end up with a final 2*2 matrix. I've tried using prod but I haven't had much luck. Is there a better way, or a particular syntax to use? Thanks!

채택된 답변

M
M 2018년 1월 11일
prod
performs element-wise multiplication.
If you want matrix multiplication, you can use something like :
A = rand(2,2,2);
res = A(:,:,1);
for i = 2:size(A,3)
res = res*A(:,:,i);
end

추가 답변 (0개)

카테고리

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