I have to create a matrix using only zeros, ones and eye
Ältere Kommentare anzeigen
This is the matrix:
1 1 1 1 1
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
so far I wrote B=ones(1,5); C=eye(4,5); A=[B;C]
But this command didn't come out right. Can someone please help me.
Akzeptierte Antwort
Weitere Antworten (1)
Rob Purser
am 21 Jan. 2019
0 Stimmen
A = eye(5);
A(1,:) = ones(1,5);
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!