MATLAB Answers

identity matrix nth order

19 views (last 30 days)
Jasneet Singh
Jasneet Singh on 19 Mar 2021
Edited: ANKUR KUMAR on 19 Mar 2021
n = [1:1:20];
M=eye(n).*0.02
its not working !! i got an error that says eye() can't draw n dimensional arrays..can it be corrected ?
if not is there any other alternative to this?

Answers (1)

ANKUR KUMAR
ANKUR KUMAR on 19 Mar 2021
Edited: ANKUR KUMAR on 19 Mar 2021
n=20;
eye(n) % identity matrix of order 20
eye(randi(50,1,1)) % identity matrix of a random order generated by randi

Tags

Community Treasure Hunt

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

Start Hunting!