MATLAB: Construct a lower triangular matrix with smaller matrices

matrixmatrix compositiontriangular

Hi all,
I'm looking for an algorithm to compute a lower triangular matrix made out of smaller, non-symmetric matrices, e.g. like:
A = [...
1 2
3 4
5 6
];
B = [...
0 0 0
A 0 0
A A 0
A A A
];
Anyone can help? (Matlab 2015b btw)

Best Answer

A = [1 2; ...
3 4; ...
5 6];
B = tril(ones(4,3), -1);
R = kron(B, A)
R =
[0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 0, 0; ...
1, 2, 0, 0, 0, 0; ...
3, 4, 0, 0, 0, 0; ...
5, 6, 0, 0, 0, 0; ...
1, 2, 1, 2, 0, 0; ...
3, 4, 3, 4, 0, 0; ...
5, 6, 5, 6, 0, 0; ...
1, 2, 1, 2, 1, 2; ...
3, 4, 3, 4, 3, 4; ...
5, 6, 5, 6, 5, 6]