Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matrix with the matrix elements

Tags:

matlab

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

enter image description here

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?

like image 378
Paris Avatar asked Nov 30 '25 15:11

Paris


1 Answers

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);
like image 114
rahnema1 Avatar answered Dec 02 '25 03:12

rahnema1



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!