MATLAB: Elementwise product ef elements of a vector times a matrix

elementwise product matrix times vector

Hello,
I have a 2×2 matrix, imagine:
A=[1 2;3 5];
And a vector, for example of dimension 6:
b=1:6;
I need to construct a matrix 2x(6×2)=2×12, in which I have 6 2×2 matrices obtained as the product of matrix A times the corresponding element of vector b.
Is there any direct way of doing this without a loop and avoiding repeating the elements (i.e. constructing two 2×12 matrices and multiply them elementwise)?
Thanks in advance,
Ana

Best Answer

kron(b,A)