Generate random 3D coordinates in a cylinder
2 ビュー (過去 30 日間)
古いコメントを表示
I want to generate a set of 1000 3D points (x,y,z) which are located inside a cylinder of radius r and centre axis from [x1,y1,z1] to [x2,y2,z2]. Any ideas?
0 件のコメント
採用された回答
Image Analyst
2015 年 9 月 21 日
Roger Stafford's code in the FAQ for getting random points in a circle will be easy to modify. http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_set_of_random_locations_within_a_circle.3F
Simply add a random variable for the height (Z) direction.
その他の回答 (1 件)
Vu Ngoc Quang
2019 年 2 月 18 日
Everyone can help me
Write Matlap code that generates 3-D coordinates of 50 points (evenly distributed). These points have the same length of 26371Km. This is the first time that I learn Matlap. So please help?
1 件のコメント
Image Analyst
2019 年 2 月 18 日
編集済み: Image Analyst
2019 年 2 月 18 日
What does evenly distributed mean to you? Random according to a uniform distribution (like raindrops on the ground), or in a regular grid like a rectangular grid or a honeycomb grid?
For a grid (of some kind) you could do
array3d = zeros(rows, columns, slices);
indexes = round(linspace(1, numel(array3d), 50));
array3d(indexes) = 1;
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!