Using kronecker product and elementwise multiplication
조회 수: 4 (최근 30일)
이전 댓글 표시
Dear all,
I have the matrix
der=[2 5 ;3 4]
OMEGA=kron(eye(2),der);
Suppose that now I have the 1 by 2 vector y
y=[3 4];
I want to multiply the first element of y with the first 'der' which is with OMEGA and the second element of y with the second 'der' which is within OMEGA.
Any ideas? Thanks in advance
댓글 수: 0
채택된 답변
James Tursa
2017년 9월 26일
편집: James Tursa
2017년 9월 26일
yy = repmat(y,size(der,1),1);
result = bsxfun(@times,OMEGA,yy(:));
or in later versions of MATLAB
result = OMEGA .* yy(:);
Should work even if der is not square.
댓글 수: 0
추가 답변 (1개)
Andrei Bobrov
2017년 9월 26일
편집: Andrei Bobrov
2017년 9월 26일
der=[2 5 ;3 4]
OMEGA=kron(eye(2),der)
y=[3 4]
out = OMEGA.*kron(y,ones(1,2))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!