blkdiag
Block-diagonal matrix from input matrices.
Syntax
Section titled “Syntax”out = blkdiag(a, b, c, ...)Description
Section titled “Description”Returns a block-diagonal matrix whose diagonal blocks are the input matrices, in order, with zero blocks elsewhere. Inputs may have different sizes (and even differing element types — promoted to a common type in the output).
Examples
Section titled “Examples”blkdiag([1 2; 3 4], 5, [6 7])% 4×4: [1 2 0 0; 3 4 0 0; 0 0 5 0; 0 0 0 6] (last row is [0 0 0 7])