MATLAB: Create a block diagonal matrix with same repeating block

前端 未结 5 1441
独厮守ぢ
独厮守ぢ 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:19

    s = 'A,';
    s = repmat(s,[1,n2]);
    s = ['B=blkdiag(', s(1:end-1),');'];
    eval(s);
    

    It can be faster than using kron-eye.

提交回复
热议问题