51 uniformly-distributed points

조회 수: 1 (최근 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