I want to create a matrix in large dimensions that the components themselves are a matrix.
Like the following example

each of the W, V, U is 18*18 matrix and the other components are zero. What is the easiest way to create such a matrix in MATLAB?
Assuming that you want a matrix that contains n x n blocks so its dimensions will be (18 * n) x (18 * n):
n=10;
z=ones(n,1);
result = kron(spdiags(z,-1,n,n),V)+kron(spdiags(z,0,n,n),U)+kron(spdiags(z,1,n,n),W);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With