As seen in the code below, I am currently generating random
numbers from a Normal Distribution
and am selecting the ones within the -3*sigma
and 3*sigma
interval. However, I now want to generate numbers such that there is a higher probability that I select numbers from outside the -3*sigma
and 3*sigma
interval. For eg. A number from [-4*sigma -3*sigma)
should have 35%
probability of being chosen and same for [3*sigma 4*sigma)
. Basically, I'll be calling this function several times and am wondering if there is a way for me to select a higher proportion of random numbers from the "tails" of the normal distribution, without actually altering the shape of the normal distribution. I'm struggling to do this.
function [new_E11, new_E22] = elasticmodulusrng()
new_E11 = normrnd(136e9,9.067e9,[1 1]);
new_E22 = normrnd(8.9e9,2.373e9,[1 1]);
while new_E11<=-3*9.067e9 && new_E11>=3*9.067e9
new_E11 = normrnd(136e9,9.067e9,[1 1]);
end
while new_E11<=-3*2.373e9 && new_E11>=3*2.373e9
new_E22 = normrnd(8.9e9,2.373e9,[1 1]);
end
Thanks
The question does not make much sense, as pointed out by Jojo: this is not a normal distribution anymore.
What you could do is to create your own Probability density functions pdf and draw from it.
For instance,
N = pdf('Normal',-5:0.2:5,0,1);
gives you the normal PDF with a good resolution. You could alter it, say
Z = N;
Z(5:15)=3*Z(5:15);
Z(35:45)=3*Z(35:45);
and use Direct Methods, Inversion Methods, or Acceptance-Rejection Methods as explained here
There is an implementation in the FileExchange: http://www.mathworks.com/matlabcentral/fileexchange/27590-simple-rejection-sampling
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments