MATLAB: Using kronecker product and elementwise multiplication

kroneckermultiplicaiton

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

Best Answer

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.