How to use a matrix of 12*12 to form a matrix of 96*96?
조회 수: 1 (최근 30일)
이전 댓글 표시
If B is a 12*12 matrix, and I want to place this B matrix as diagonal matrix of 96*96, How to form this 96*96 diagonal matrix?
댓글 수: 4
채택된 답변
추가 답변 (1개)
Paul
2021년 9월 22일
It's too bad we can't do something like this:
B = [1 2;3 4]; repeats = 2; % use a smaller example
% R = blkdiag(repmat({B},1,repeats){:}) % throws error
and instead have to do this
R = blkdiag(struct('temp',repmat({B},1,repeats)).temp)
댓글 수: 1
Stephen23
2021년 9월 22일
Simpler:
B = {[1,2;3,4]};
R = 2; % use a smaller example
M = blkdiag(B{ones(1,R)})
참고 항목
카테고리
Help Center 및 File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!