It seems like the formula that you are using for finding μ and σ is inaccurate. The current formula seems to be finding μ as the logarithm of the geometric mean of the minimum and maximum diameters, but you want the mean to be 200 µm and the standard deviation to be 0.1 times the mean. Note that the parameters μ and σ are not the mean and standard deviation in logarithmic scale. They are simply parameters of the distribution that need to be calculated from the actual mean and standard deviation in linear scale.
The correct formula for μ and σ in terms of
(mean) and
(standard deviation) for a Log-normal distribution is shown below:
and ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1809808/image.png)
Therefore, the code for calculating mu and sigma can be changed to the following:
std_dev = 0.1 * mean_diameter;
mu = log(mean_diameter^2 / sqrt(std_dev^2 + mean_diameter^2));
sigma = sqrt(log(1 + (std_dev^2 / mean_diameter^2)));
Regarding the issue of overlapping pores with the axis, you can fix this by adjusting the centres by a distance equal to their radius. Here's how you can do that:
X(i) = min(max(X(i) - diameters(i)/2, 0), domain_size - diameters(i));
Y(i) = min(max(Y(i) - diameters(i)/2, 0), domain_size - diameters(i));
The resultant plot is shown below:
Hope it helps!