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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by