Insert an identity matrix into a larger dimension of null matrix

5 vues (au cours des 30 derniers jours)
pradeep kumar
pradeep kumar le 7 Sep 2014
Commenté : pradeep kumar le 7 Sep 2014
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

Réponse acceptée

Rick Rosson
Rick Rosson le 7 Sep 2014
N = diag([0 0 1 1 1])

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by