How can i create a vector having 6 values between two numbers
조회 수: 15 (최근 30일)
이전 댓글 표시
How can i create a vector having 6 values between 2 and 12 including the end points 2 and 12?
댓글 수: 0
답변 (1개)
Sindar
2020년 10월 10일
Assuming you want them evenly spaced:
x = linspace(2,12,6);
If you want them randomly spaced
x = [2 ; 2+(12-2)*rand(4,1) ; 12]
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!