randspace

版本 1.0.0.0 (1.9 KB) 作者: Dmitry Savransky
Generates a monotonically increasing sequence of randomly spaced values.
1.3K 次下载
更新时间 2008/6/23

查看许可证

RANDSPACE Generates a monotonically increasing sequence of randomly
spaced values.

y = randspace(P1, N) generates N points greater than or equal to P1
with intervals between the points equal to random values in [0,1].

y = randspace(P1, N, P2) cuts off the generated sequence at P2.
NOTE: If P2 is set, the length of the generated sequence may be less
than N.

y = randspace(P1, N, P2, STEP_RANGE) generates the intervals between
points according to STEP_RANGE. STEP_RANGE must contain two elements
indicating the minimum and maximum desired intervals. The first element
must be less than the second.

y = randspace(P1, N, P2, STEP_RANGE, SEED) uses SEED as the state for
the random number generator. SEED must be either a scalar or a 35
element vector. See the doc for randn for details.

Examples:
%generate 10 randomly spaced values starting at 0
y = randspace(0,10)

%generate at most 10 randomly spaced values between 1 and 6
y = randspace(1, 10, 6)

%generate 10 values starting at 0 with intervals between 1 and 5
y = randspace(0,10,[],[1,5])

%generate 10 randomly spaced values starting at 0 using one state
y = randspace(0,10,[],[],1)

引用格式

Dmitry Savransky (2024). randspace (https://www.mathworks.com/matlabcentral/fileexchange/20341-randspace), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R14SP1
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Random Number Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0