How to create a diagonal matrix from several different size matrices

20 ビュー (過去 30 日間)
alex
alex 2019 年 2 月 3 日
編集済み: Stephen23 2019 年 2 月 3 日
Hello. I want to compute a diagonal matrix from several matrices with different sizes.for exampe A=diag(A1,A2,A3,...). A1, A2 and A3 are matrices with different sizes. Can any one help me plz? regards.

回答 (1 件)

Stephen23
Stephen23 2019 年 2 月 3 日
編集済み: Stephen23 2019 年 2 月 3 日
It is not clear if you want those matrices to be converted to a diagonal-only matrix, or if you want a block-diagonal matrix. Here is how to generate a block-diagonal matrix:
blkdiag(A1,A2,A3,...)
or simpler:
C = {cell array of all of your matrices}
blkdiag(C{:})

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by