How to create this matrix without using loop?
Ältere Kommentare anzeigen
Hi,
I was wondering how to create this gradient matrix without using a loop ?
1 1 1 1 1
1 4 4 4 4
1 4 9 9 9
1 4 9 16 16
1 4 9 16 25
I already have the main diagonal completed using the following
x = 1 + cumsum(3:2:9)
I don't know how to do the rest, any help would be great.
Andy
1 Kommentar
Image Analyst
am 13 Okt. 2018
Are we doing your homework for you? http://www.mathworks.com/matlabcentral/answers/13205#answer_18099
Antworten (1)
a=cumsum(1:2:9);
result=min(a,a.'),
Kategorien
Mehr zu MATLAB 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!