When creating a vector why does the size change when using a variable vs using a value?

1 回表示 (過去 30 日間)
I am trying to create the time vector that starts at 0, has a step size of variable predefined (stepsize) and ends at predefined variable (fin_time).
In this case I calculated stepsize=0.0990 and fin_step=14.256
It would look like this time=[0:stepsize:fin_time]. When I type this I get a 144x1 vector.
When I type the value of stepsize manually. time=[0:0.0990:fin_time] I get a 145x1 vector. This is what I want.
How come the variable is exactly the same value but gives a different answer?

採用された回答

Stephen23
Stephen23 2021 年 4 月 10 日

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by