MATLAB: Create a block diagonal matrix with same repeating block

前端 未结 5 1453
独厮守ぢ
独厮守ぢ 2020-12-09 11:03

I have a matrix K of dimensions n x n. I want to create a new block diagonal matrix M of dimensions N x N, such that it c

5条回答
  •  误落风尘
    2020-12-09 11:35

    The following should work:

    d=5; K=eye(3); T = cell(1,d);

    for j=1:d T{j} =K; end

    M = blkdiag(T{:})

提交回复
热议问题