How to create a vector, knowing start, increment and number of values.

100 ビュー (過去 30 日間)
ARTURO CIONI
ARTURO CIONI 2021 年 2 月 18 日
コメント済み: ARTURO CIONI 2021 年 2 月 18 日
I need to create a vector from values taken from a struct array. I think i know how to get those values but i don't understand how to create said vector havng start value (6.333954480229592e-06) the increment (3.906250000000000e-05) and the number of values (537600).
Appreciate any help

採用された回答

Stephen23
Stephen23 2021 年 2 月 18 日
B = 6.333954480229592e-06;
I = 3.906250000000000e-05;
N = 537600;
V = B + I*(0:N-1);

その他の回答 (1 件)

Steven Lord
Steven Lord 2021 年 2 月 18 日
Let's take a simpler example. Start at A = 1 with an increment d = 0.5 and create a vector with n = 5 values. The vector is [1, 1.5, 2, 2.5, 3].
What's the first value in terms of A, d, and/or n?
What's the second value in terms of A, d, and/or n?
What's the third value?
Can you see a way to generalize this pattern?
  1 件のコメント
ARTURO CIONI
ARTURO CIONI 2021 年 2 月 18 日
Appreciate you teaching me instead of giving me the answer, both yours and Stephen's comment helped a lot, thanks!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by