randpoly

版本 1.0.1 (2.4 KB) 作者: John D'Errico
Generate N uniformly distributed points inside a supplied polygon (or polyshape)
20.0 次下载
更新时间 2023/3/2

查看许可证

This tool allows a user to generate randomly (uniformly) distributed points inside a polygonal region, so any simple region in the (x,y) plane you can describe with a polygon, or a polyshape.
PS = polyshape([0 0;1 0;1 1;.6 .3])
xy = randpoly(100,PS);
plot(xy(:,1),xy(:,2),'ro')
hold on
plot(PS)
The scheme used is a constructive one that is uniformly distributed in the given 2-dimensional domain. It is NOT a rejection scheme, as they can be extremely wasteful of CPU time.

引用格式

John D'Errico (2024). randpoly (https://www.mathworks.com/matlabcentral/fileexchange/125580-randpoly), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2022b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

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

Added tags

1.0.0