write a script that creates identity matrices of any size without using the function eye

thank you

댓글 수: 2

@ Chloe St John: it is not appreciated when you delete your question text. This has the effect of treating us as your own disposable personal assistants, which we are not. If you want private help then you will find plenty of consultants who will gladly take your money and offer whatever private advice you want.
If you are concerned about your tutor or professor finding that you have been given all answers to your homework, then perhaps consider that before posting onto a public forum:

댓글을 달려면 로그인하십시오.

답변 (2개)

Stephen23
Stephen23 2019년 1월 24일
편집: Stephen23 2019년 1월 24일
Don't use a loop, learn to write simple vectorized code:
N = 5;
M = zeros(N);
M(1:N+1:end) = 1

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2019년 1월 24일

댓글:

2023년 3월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by