Reputation: 1735
I tried to generate random points inside sphere by using following commands with center at origin by using following code
no_of_spots = 3000
radius=20
rvals = (2)*rand(no_of_spots,1)-(1);
elevation = asin(rvals);
azimuth = 2*pi*rand(no_of_spots,1);
radii = rand(no_of_spots,1)*radius;
[point_x,point_y,point_z] = sph2cart(azimuth,elevation,radii);
From figure it is random points are concentrated near origin, ie looking like Gaussian distribution. I need random points distributed inside sphere uniformly or need to shift concentration of points from center to another point. How can I do that/ Can anyone help/ Thanks in advance, Manu
Upvotes: 4
Views: 971