51 uniformly-distributed points

4 ビュー (過去 30 日間)
Jamie Williamson
Jamie Williamson 2021 年 9 月 15 日
編集済み: Dave B 2021 年 9 月 15 日
I have a question asking for 51 uniformly distributed points. How might this be done?
Replaces the continuous domain of xM from 0 to 5 (i.e. 0 ≤ xM ≤ 5) with a set of 51 uniformly-distributed points.

採用された回答

Dave B
Dave B 2021 年 9 月 15 日
編集済み: Dave B 2021 年 9 月 15 日
You can create uniformly (linearly) distributed values with the linspace function:
x = linspace(0, 5, 51)
x = 1×51
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
Alternatively, you might have noticed that the set of points you're looking for are 0.1 increments, and could have used the colon operator to accomplish the same:
x = 0:.1:5
x = 1×51
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

その他の回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by