How to generalize the size of identity matrix as that of any size of input matrix

5 vues (au cours des 30 derniers jours)
My input matrix M of size 5X5, I want an identity matrix of its size so I gave I=ones(5).I have to change every time the size of identity matrix to that of the size of input matrix.
I want generalized way of identity matrix any help regarding this query please.

Réponse acceptée

Walter Roberson
Walter Roberson le 1 Déc 2015
eye(length(M))

Plus de réponses (0)

Catégories

En savoir plus sur Operators and Elementary Operations 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