Using kronecker product and elementwise multiplication

4 ビュー (過去 30 日間)
ektor
ektor 2017 年 9 月 26 日
編集済み: James Tursa 2017 年 9 月 26 日
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

採用された回答

James Tursa
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.

その他の回答 (1 件)

Andrei Bobrov
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))

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by