How can I diagonalize a matrix which consists of matrix?
3 次查看(过去 30 天)
显示 更早的评论
I have a matrix like this.
[[A]; [B]; [C]],
where, [A], [B], [C] are matrix having arbitral size. Actually, the real matrix I'm handling has much bigger size ([A], [B], [C], [D], [E], ... more than 100)
What I want to get is [[A] [0] [0]; [0] [B] [0]; [0] [0] [C]].
here, each [0] has proper matrix size.
I can do this using for-loop but I'd like to find a simpler and faster way.
Could you guys help me please?
0 个评论
回答(1 个)
Steven Lord
2018-9-20
2 个评论
Sinwoo Jeong
2018-9-20
Thank you for your comment. But that function makes me to type blkdiag(A, B, C, D, E, ...). In my case, I have more than 100 matrices. Could you please tell me how I can avoid typing every single matrix name?
Steven Lord
2018-9-20
Store your matrices in a cell array instead of in individual variables.
C = {magic(5), ones(4), full(gallery('tridiag', 7))}
D = blkdiag(C{:})
另请参阅
类别
在 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!