Generate random 3D coordinates in a cylinder
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lucy
el 21 de Sept. de 2015
Editada: Image Analyst
el 18 de Feb. de 2019
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 comentarios
Respuesta aceptada
Image Analyst
el 21 de Sept. de 2015
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.
Más respuestas (1)
Vu Ngoc Quang
el 18 de Feb. de 2019
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 comentario
Image Analyst
el 18 de Feb. de 2019
Editada: Image Analyst
el 18 de Feb. de 2019
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;
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!