Create delimited random vertices

2 次查看(过去 30 天)
I need to randomly generate 5 points delimited in (0< X< 50) and ( 0< Y< 50)and automatically arrange these in increasing value

采纳的回答

Ameer Hamza
Ameer Hamza 2020-11-27
You can sort the randomly generated values
x = sort(randi([1 49], 5, 1));
y = sort(randi([1 49], 5, 1));
  7 个评论
Ameer Hamza
Ameer Hamza 2020-11-27
You can use rescale in that case
x_lims = [0 50];
y_lims = [0 50];
z_lims = [50 50];
n = 5;
x = rescale(sort(rand(n,1)), x_lims(1), x_lims(2))
y = rescale(sort(rand(n,1)), y_lims(1), y_lims(2))
z = rescale(sort(rand(n,1)), z_lims(1), z_lims(2))

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by