row that increases more every element
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
RozuSolo
am 20 Mai 2022
Beantwortet: RozuSolo
am 20 Mai 2022
Hello,
I was wondering how I would make an array that increases more every element
for example:
given lets say n=randi([10 20], 1);
how would i have vect1 = 9, 16, 25, 36, ... n: so bascially increasing by +2 every element starting at 9
3 Kommentare
Walter Roberson
am 20 Mai 2022
Your example increases by 9 each time, not by 2?
Are you wanting to start with the fixed value 9 and use the random number to determine the number of terms??
Akzeptierte Antwort
Weitere Antworten (1)
DGM
am 20 Mai 2022
Here's my guess:
A = randi([10 20], 1,10)
B = cumsum(A) % cumulative sum of A
0 Kommentare
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!