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

조회 수: 1 (최근 30일)
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.

채택된 답변

Walter Roberson
Walter Roberson 2015년 12월 1일
eye(length(M))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by