How to use a matrix of 12*12 to form a matrix of 96*96?
2 次查看(过去 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!