Insert an identity matrix into a larger dimension of null matrix

5 ビュー (過去 30 日間)
pradeep kumar
pradeep kumar 2014 年 9 月 7 日
コメント済み: pradeep kumar 2014 年 9 月 7 日
hellow everyone ! Suppose i have an identity matrix .
I=eye(3) which will produce
I = [1 0 0
0 1 0
0 0 1]
Now i want to insert I into a (5X5) null matrix such that my result will be
N = [0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1]
How could i achieve this efficiently .Thanks in advace

採用された回答

Rick Rosson
Rick Rosson 2014 年 9 月 7 日
N = diag([0 0 1 1 1])

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by