필터 지우기
필터 지우기

want to multiply two matrices each time in a particular position according to randperm matrix position

조회 수: 2 (최근 30일)
hi all, i want to multiply 2 50 x 50 matrix, according to the position of reandperm matrix. i.e first i ll generate randperm matrix, it consists of 50 elements. Now according to the elements in randperm ie if the first element is 20,i want to multiply 20 th position element in the both matrix. like this i have to multiply all 50 positions and have to sum it. how to do it in matlab. If anyone know, Pls suggest me too.
  댓글 수: 1
Cedric
Cedric 2013년 9월 3일
편집: Cedric 2013년 9월 3일
What are you calling "20th element" of 50x50 matrices? Is it a linear index(?), an index related to diagonals(?), anything else?

댓글을 달려면 로그인하십시오.

답변 (2개)

Matt J
Matt J 2013년 9월 3일
편집: Matt J 2013년 9월 3일
rp=randperm(50);
result = dot( Matrix1(rp), Matrix2(rp));

Matt J
Matt J 2013년 9월 3일
편집: Matt J 2013년 9월 3일
rp=randperm(50);
result = Matrix1(rp,:)*Matrix2(:,rp);
or
result = Matrix1(:,rp)*Matrix2(rp,:);

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by