Matlab: generate random numbers from normal distribution with given probability

Jojo

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

Hugues Fontenelle

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.

edited at
0

Comments

0 comments
Login to comment

Related

Generate random numbers from a normal distribution

How to generate random positive floating point numbers with normal distribution from 0 up to a given ceiling?

Generate random numbers with a given distribution

Generate random numbers from a distribution given by a list of numbers in python

How to generate random numbers with predefined probability distribution?

generate N random numbers from a skew normal distribution using numpy

Generate numbers from normal distribution

Generate random variables from a probability distribution

Generate random numbers from empirical cumulative distribution function in MATLAB

Generate random numbers with a given (numerical) distribution

Generate random numbers with a numerical distribution in given intervals

How to generate n random numbers from a normal distribution using random-fu (Haskell)?

Generate a random number from normal distribution in J

generate random decimal numbers from 0 to 1 with normal distribution using numpy

How to generate random numbers when given the value of a probability density function?

how do you generate random numbers from a bimodal Gaussian Probability Density Function in MATLAB?

C++ - generate random numbers following normal distribution within range

How to generate random numbers with a normal distribution based on endpoints in excel?

How to generate random numbers with skewed normal distribution in R?

How to generate random numbers from the given numbers

Generate random numbers from lognormal distribution in python

Draw random numbers from the Gumbel distribution in Matlab

Generate random number with given probability

Multivariate Normal Distribution Matlab, probability area

Generate random float from Standard Normal distribution and multiply by another float

How to sample random numbers of particular variance from truncated normal distribution?

How to generate a random probability distribution julia

Draw random numbers from a custom probability density function in Matlab

Given a uniform distribution of a variable, use a function of random variables to plot the probability density function MATLAB