How to create normal distribution with positive integers in matlab with bell shape graph?

From the scripts below, the cracks were distributed randomly in the rock formation with dimensions of 200x200. The crack density is estimated from the scripts and the histograms of crack density and final crack lengths are plotted. My task is to distribute the cracks not randomly but probabilistically with normal distribution. I have edit the rand code in matlab to randn (which normally distributes the random numbers). Since in matlab normal distribution using positive and negative integers, the negative integers were eliminated with abs code which uses only absolute integers via converting negative integers to positive since I cannot have negative cracks.
t = 0.2 + 0.1.*randn(L,L);
r = abs(t);
z = r<porosity;
The 0.2 and 0.1 are referred as mean and standard deviation so I made them up in order to get bell shaped distribution. For normal distribution, the graph should be bell shaped but from the edited scripts I am getting half of the bell shape and it is not evenly distributed as it normally distributes. Is there any ways of getting normal distribution with bell shape?

6 Comments

What is
z = r<porosity;
intended to compute? It will be a logical array of those positions that satisfy the equality; the choice of z as variable name makes me suspect you have something else in mind???
The distribution of abs(randn(u,s)) will be somewhat bell-shaped but will be much more centered towards the mean than a normal as you're "doubling up" the probabilities of each percentage in the range [0,z] over what it is in actual normal since -z and +z are now the same point.
I would suggest you need to use something other than a normal for the underlying distribution; I don't know the particular field of investigation but I'd presume there likely are candidate distributions in the literature that have been used for the purpose; I'd suggest doing some searches there for same.
Thanks very much for your time and consideration, So I have now decided to use lognormal distribution but I am not getting the right shape on the histogram.
z = r<porosity
is used in order to reject values greater than 0.041 in the matrix with lognormal distribution. My aim is to show from the scripts the histogram with crack lengths against number of cracks that follows the correct shape of lognormal distribution. Do you have any suggestion on this matter?
Well, if you truncate a lognormal it won't look much like a lognormal shape (and won't be, either). While I didn't dig into the above reference and certainly not the cites that I elided that were the references, I'd presume they used the parameters of the distributions to model the variable rather than trying to doctor up (for lack of better words at the moment) the result. To plot, look at
doc ecdhist
examples; first is a truncated exponential that is similar in what you've tried but if you truncate excessively the results won't look much like lognormal 'cuz it'll be the tail you'll eliminate...
I am not seeking to get truncated lognormal shape, it is what I was getting from the histogram. I am fine with shape that looks more like lognormal distributed. Could you please give details of
doc ecdhist
coz I could not find what is it...
Typo, sorry...there's an 'f' missing--
ecdfhist % Emprical CDF Histogram function (Statistics Toolbox)
Regular old }hist| will work; if it doesn't show the tails, not large enough sample size or number of bins is probably the cause; increase both.
I gotta' meeting in town, gotta' run...
ADDENDUM
OK, am back...here's example of what was alluding to--
Three histograms of lognrnd, first two with 100 samples but default 10 then 20 bins (red/cyan outlines, respectively), then 1000 samples and 50 bins (white). The shape improves with resolution and number of samples altho is a long tail for even the lower; that's just what lognormal does. How much depends on the shape factor, of course.
Can you post an image of your cracks to help us better visualize it? Also, do you have the Statistics and Machine Learning Toolbox? And, FYI, you might look at RANDRAW: http://www.mathworks.com/matlabcentral/fileexchange/7309-randraw

Sign in to comment.

Answers (1)

Gargle is your friend... :)
has a list of a half-dozen candidate distributions with references to previous validations of their appropriateness.
Suitability and use of different PDFs to characterize the
statistical variation of fracture geometrical parameters.
PDF Length Orientation Location
Normal No Yes No
Lognormal Yes No No
Exponential Yes No No
Power law Yes No No
Fisher No Yes No
Poisson No No Yes
These were in light of some Monte Carlo study methods; I've no idea if has any bearing to your problem but just from a "reasonableness" of physical characteristics I can see reasons for the choices above, particularly for throwing out the normal as a length distribution for the problems you have if nothing else.

Asked:

on 4 Apr 2017

Commented:

on 6 Apr 2017

Community Treasure Hunt

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

Start Hunting!