フィルターのクリア

Difference between x = 0:0.1:2*pi and linspace(0,2*pi,0.1)

13 ビュー (過去 30 日間)
Dhairya
Dhairya 2022 年 11 月 13 日
コメント済み: Dhairya 2022 年 11 月 13 日
i was going through a matlab code and it had x = 0:0.1:2*pi written
i wanted to ask what is the difference between this and linspace and how it is used?

採用された回答

David Hill
David Hill 2022 年 11 月 13 日
Linspace divides the interval into the exact number specified, while colon notation just keeps increasing the interval by the middle number not to exceed the last number.
x=0:.1:2*pi
x = 1×63
0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000 1.9000 2.0000 2.1000 2.2000 2.3000 2.4000 2.5000 2.6000 2.7000 2.8000 2.9000
y=linspace(0,2*pi,63)
y = 1×63
0 0.1013 0.2027 0.3040 0.4054 0.5067 0.6081 0.7094 0.8107 0.9121 1.0134 1.1148 1.2161 1.3174 1.4188 1.5201 1.6215 1.7228 1.8242 1.9255 2.0268 2.1282 2.2295 2.3309 2.4322 2.5335 2.6349 2.7362 2.8376 2.9389
See the difference.

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by