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

 채택된 답변

추가 답변 (1개)

Image Analyst
Image Analyst 2018년 10월 13일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2018b

태그

질문:

2018년 10월 12일

답변:

2018년 10월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by