MATLAB Answers

Generating a cylindrical cluster

1 view (last 30 days)
Girvani Manoharan
Girvani Manoharan on 21 Mar 2019
I have created a 3D cluster and assigned values to represent a sandstone as attaced (3dlattice). Now, I want to create a cylinder to resemble a core and randomly assign two particular values across the cylinder. I am working with the below code but couldn't achieve my goal. I would appreciate, if you could guide me on the correct path?
n=10000; % number of points that you want
center = [20 ,20]; % center coordinates of the circle [x0,y0]
radius = 12.5; % radius of the circle
angle = 2*pi*rand(n,1);
r = radius*sqrt(rand(n,1));
X = round(r.*cos(angle)+ center(1));
Y = round(r.*sin(angle)+ center(2));
Thank you.

Answers (0)

Community Treasure Hunt

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

Start Hunting!