Generate a increasing increment array
7 次查看(过去 30 天)
显示 更早的评论
Hi,
I was wondering how to generate array as follow
1 4 9 16 25
As you can see, the differences between them is
3 5 7 9
of increasing order. I was wondering how to do that without using any loop?
Thanks Andy
0 个评论
采纳的回答
更多回答(1 个)
Image Analyst
2018-10-13
Not sure what the rule is (actually I guess Walter figured it out since you accepted it), but here's another way:
>> v = (1:5).^2
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!