matlab - Replace each element in a matrix with a diagonal matrix -


say have matrix of dimension nxv. want create larger matrix of size ntxvt, i.e. want replace each element e of matrix a(e) diag(t)*a(e)., while keeping general orientation of matrix (for instance, a(e) left of a(e-1), diag(t)*a(e) left of diag(t)*a(e-1).

is there trick accomplish in matlab? (making each diagonal matrix , concatenating them take forever).

many ^^

a = magic(3); t = diag([-1 1]); kron(a,t) 

gives

-8     0    -1     0    -6     0  0     8     0     1     0     6 -3     0    -5     0    -7     0  0     3     0     5     0     7 -4     0    -9     0    -2     0  0     4     0     9     0     2 

ps. copied idea this example


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -