How to find out radii of spheres when mean and standard deviation of radius distribution is know and sum of volumes of all spheres is constant?

5 views (last 30 days)
A sample problem may look like one given below.
Sum of volumes of all sphere = 100 unit^2
Distribution of radii = Gaussian
Mean of Radii = 2 unit
Standard Deviation = 0.5 unit
I am expecting vector of radii as output.
  2 Comments
Torsten
Torsten on 2 Jul 2015
radii following a gaussian distribution don't make much sense to me because they have to be positive.
Best wishes
Torsten.
Abhishek Kumar
Abhishek Kumar on 2 Jul 2015
agreed. the distribution should be lognormal or something which ensures a non negative radii. The moments of distribution mentioned were standard deviation and mean so wrongly interpreted it to be normal distribution. But how one can take the problem for arbitrary distribution. Thanks a lot.

Sign in to comment.

Accepted Answer

Thorsten
Thorsten on 2 Jul 2015
Edited: Thorsten on 2 Jul 2015
First let's clarify some points: 1. If it is the volume, the unit should be unit^3; otherwise it would be the area of a circle; so let's assume that you made a typo and look for a volume of 100 unit^3. 2. The sum of volumes wouldn't be exactly 100, because you draw the radii from a distribution of random numbers. So let's assume that you want the vector of as much values of radii whose corresponding volumes of spheres sum up to a value of 100 units^3.
OK, to start with, let's approximate this number of radii we need: The average radius would be 2, as this is the average of the random distribution. The formula for the corresponding volume of a sphere is V = 4/3*pi*r^3; so the average number of radii you need is
r_mean = 2;
r_std = 0.5;
desired_sum_of_volumes = 100;
N = round(desired_sum_of_volumes/(4/3*pi*r_mean^3));
To be same, generate a vector of twice as much normally distributed numbers of the desired mean and std:
r = r_mean + r_std*randn(1, 2*N);
There is a small probability of non-positive values; so to be safe, let's get rid of them:
r = r(r>0));
The corresponding sum of volumes is
V = 4/3*pi*r.^3;
Sum up the volumes and find the largest index where the sum is smaller than the desired value:
idx = find(cumsum(V) < 100, 1, 'last');
Now you pick up the radii from 1 up to this number:
r = r(i:idx);
Et voilà!
If you are a fan of less concise coding, you could write it as
r = r_mean + r_std*randn(1, round(2*desired_sum_of_volumes/(4/3*pi*r_mean^3)));
r = r(r>0));
r = r(1: find(cumsum(4/3*pi*r.^3) < 100, 1, 'last'));
  3 Comments
Abhishek Kumar
Abhishek Kumar on 2 Jul 2015
I am extremely sorry it should had been unit^3. And the normal distribution as assumption for radii too is not true. Thanks for the solution. Can you tell how can distribution of prolate ellipsoidal (a=b<c) voids (of different sizes) can be statically expressed. I mean as in this case there will be more variable then compared to sphere. Orientation of axis of ellipsoid and there will two lengths for semi principle axis.
Thorsten
Thorsten on 2 Jul 2015
Torsten is right, there is always an non-zero probability for any values for a normal distribution. For your combination of mean 2 and sigma 0.5, there is a small probability of
normcdf(0, 2, 0.5)
0.000032
that you generate negative radii. So to be save, I added
r = r(r>0));
above to get rid of any negative values.
I don't completely get your question regarding ellipsoidals. If you need the volume, you can ignore the orientation. If you have two random values, just generate them accordingly to their corresponding values of mean and std. If you have further problems. please post a new question.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!