sphere_count(1,2,4,0.025,0.885)
function [ s ] = sphere_count( x,y,z,b_d,d )
sample_vol = x*y*z;
air_pc = 1-(d./0.917);
air_vol = sample_vol*air_pc;
sphere_vol = 4*pi*((b_d/10)./2)^2;
number_of_spheres = floor(air_vol/sphere_vol);
P = [(x.*rand(1,1)),(y.*rand(1,1)),(z.*rand(1,1))];
k = 1;
while k < number_of_spheres
    P1 = [(x.*rand(1,1)),(y.*rand(1,1)),(z.*rand(1,1))]; 
    D = pdist2(P1,P,'euclidean'); 
    if D>(b_d/2) 
        P=[P;P1];  
        k=k+1;
    end
end
x=P(:,1);y=P(:,2);z=P(:,3); 
a = 0.02; 
b = b_d; 
R = a.*randn(numel(P(:,1)),1) + b;
bubbleplot3(x,y,z,R);