row that increases more every element
1 view (last 30 days)
Show older comments
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
Accepted Answer
More Answers (1)
DGM
on 20 May 2022
Here's my guess:
A = randi([10 20], 1,10)
B = cumsum(A) % cumulative sum of A
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!