From: tinne123 on
Hi folks,

is there any command / efficient way that would help to arrange square matrices of one size into a big one so that they are on the diagonal and all elsewhere there 'd be zeros?

a, b, c .. are (n,n)

e.g. n = 2

BIG =
a11 a12 0 0 0 0
a21 a22 0 0 0 0
0 0 b11 b12 0 0
0 0 b21 b22 0 0
0 0 0 0 c11 c12
0 0 0 0 c21 c22

I would like to avoid writing down zeros() and concatenating with a,b,c-s etc, but
maybe that is the only way... Many thanks for hints!
From: John D'Errico on
"tinne123 " <nastanova(a)yahoo.co.uk> wrote in message <htcavt$4p5$1(a)fred.mathworks.com>...
> Hi folks,
>
> is there any command / efficient way that would help to arrange square matrices of one size into a big one so that they are on the diagonal and all elsewhere there 'd be zeros?
>
> a, b, c .. are (n,n)
>
> e.g. n = 2
>
> BIG =
> a11 a12 0 0 0 0
> a21 a22 0 0 0 0
> 0 0 b11 b12 0 0
> 0 0 b21 b22 0 0
> 0 0 0 0 c11 c12
> 0 0 0 0 c21 c22
>
> I would like to avoid writing down zeros() and concatenating with a,b,c-s etc, but
> maybe that is the only way... Many thanks for hints!

This is a block diagonal matrix. Why nor use
blkdiag, the tool that is designed to build exactly
that class of matrix?

John
From: Walter Roberson on
tinne123 wrote:

> is there any command / efficient way that would help to arrange square
> matrices of one size into a big one so that they are on the diagonal and
> all elsewhere there 'd be zeros?

blkdiag()
From: tinne123 on
Hi guys, many thanks, especially given the fact that I'm totally non-advanced user and have to think about each small step.