Help Formatting Vector To Not Include Starting Point

조회 수: 14 (최근 30일)
Bailey Smith
Bailey Smith 2018년 6월 6일
댓글: Bailey Smith 2018년 6월 6일
I am trying to create a vector of linearly spaced numbers, but not including zero (but I need to start from zero).. Say I wanted five linearly spaced numbers from zero to two (and including two), but not including zero, how would I go about this? As far as I am aware, linspace always includes the starting point, right? Thank you!

채택된 답변

Stephen23
Stephen23 2018년 6월 6일
N = 5;
vec = linspace(0,2,N+1);
vec = vec(2:N);
  댓글 수: 2
Bailey Smith
Bailey Smith 2018년 6월 6일
I still need it to include the end point, just not the starting point. This only gives me 4 points instead of 5.
Bailey Smith
Bailey Smith 2018년 6월 6일
Nevermind. I see you missed the +1 on the second vector. Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by