MATLAB: Matrices in a matrix

matrix manipulation

I have this matrix in which there are 9 different matrices each one is composed by 6 * 6 elements
I want pre and post multiply each matrix-elements in this way:
A is a matrix with the same size of R
P.S. : I have store R and A as a sparse matrices
How can I do?
Thanks

Best Answer

Hi UGO, should your top row read R11, R12, R13? at any rate, try
z = zeros(size(A));
C = [A z z;z A z;z z A];
B = C.'*R*C
where C is a block diagonal matrix.