I have a square matrix of size C
by C
and I want to build a diagonal block matrix with it repeated N=2C(1+C)
times. The problem is that the value of C
can change, and so I don't know if I could use blkdiag
, as I don't know the number of parameters I should enter because the size of the matrix is a variable that the user chooses. How could I do this in MATLAB?
2
votes
blkdiag
with variable parameters? – Andras Deakblkdiag(A,A,A)
, for example. How could I write that without hardcoding the number of matrices? – Tenderotmpcell = repmat({A},[1, 2*C*(1+C)]); out = blkdiag(tmpcell{:})
. – Andras Deak