Using only "eye" and "zeros" ...
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rising
am 8 Sep. 2014
Beantwortet: the cyclist
am 8 Sep. 2014
Hi,
I'm doing some unsolved exercises I've been assigned and there is this one that I can't seem to find the answer to (teacher is unavailable so I can't ask him).
I need to obtain the following matrix by only adding matrices made with the commands "eye" and "zeros". That's all it says. This is the matrix I need to obtain:
2 1 0
0 2 1
0 0 2
And needs to be for NxN (any square dimension). Is this really possible? Thanks.
0 Kommentare
Akzeptierte Antwort
the cyclist
am 8 Sep. 2014
Definitely possible.
Since this is a homework exercise, I'll just give you one small hint, which might get you unstuck.
To access a portion of a matrix (for example just the upper left part), you can use this syntax:
A = zeros(5,5);
A(1:3,1:3) = magic(3);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!