blkdiag

Matlab Functions List


  • B = blkdiag(A1,...,AN) returns the block diagonal matrix created by aligning the input matrices A1, …, AN along the diagonal of B
>> A1 = ones(2,2); A2 = 2*ones(3,2); A3 = 3*ones(2,3); 
 
>> B = blkdiag(A1, A2, A3)
B =
     1     1     0     0     0     0     0
     1     1     0     0     0     0     0
     0     0     2     2     0     0     0
     0     0     2     2     0     0     0
     0     0     2     2     0     0     0
     0     0     0     0     3     3     3
     0     0     0     0     3     3     3