Re: Gaussian to uniform random numbers generator
- From: "jael 1506" <jael1506@xxxxxxxxxxxxx>
- Date: Fri, 28 Mar 2008 15:11:02 +0000 (UTC)
Randy,
that's what i was looking for.
Thanks a lot!
J.
Randy Poe <poespam-trap@xxxxxxxxx> wrote in message
<f5e911d3-73fe-42b2-9159-c15ccff8e76b@xxxxxxxxxxxxxxxxxxxxxxxxxxx>...
On Mar 28, 8:45 am, "jael 1506" <jael1...@xxxxxxxxxxxxx>wrote:
to findHello,
I need to generate uniform or gaussian random numbers
depending on the area. I will explain myself:
Imagine a 0-1 normal distribution (e.g., numbers you can
generate using randn). 90% of the probability is located
between -1.645 and 1.645. 5% is corresponds to x<-1.645 and
the other 5% to x>1.645.
Now i want to substitute the gaussian pdf by a uniform
distribution in the interval [-1.645, 1.645] so that the
probability for all the points in that interval is the same
and the sum of these probabilities is 0.9 (i.e., the area
under the horizontal line describing the uniform
distribution corresponds to the 90% of the total area). The
resulting picture is: Gaussian (x<-1.645, cdf=5%) - Uniform
(-1.645<x<1.645, cdf=90%) - Gaussian (x>1.645, cdf=5%).
This distribution might be useful if you want to share money
among some people: The same probability if they are close to
you (e.g.,your brothers, uniform distribution) and less and
less probability as they go "further" from you (i.e.,
cousins, friends, neighbours, enemies, etc..., gaussian
distribution).
How could i generate these random numbers in Matlab giving
the mean, the standard deviation and the probability
assigned to the uniform region?
Sorry if i did not explain it correctly. I am not an expert
in statistics.
The standard way to generate random numbers from an
arbitrary distribution is to use the cumulative distribution.
1. Generate a uniform random number r in [0,1].
2. Find the number x such that P(X <= x) = r.
3. x is your output randum number.
The details of step 2 vary with the distribution. For you,
it might be something like:
2a. If r < 0.05 or r > 0.95, use the error function erf
the appropriate x. (I have to scribble a little to get theinterpolation
expressions right for this one, sorry).
b. Otherwise, calculate the fraction (r-0.05)/0.90, and
output x = -1.645 + fraction*(2*1.645). That's a linear
from -1.645 to +1.645.
- Randy
.
- References:
- Gaussian to uniform random numbers generator
- From: jael 1506
- Re: Gaussian to uniform random numbers generator
- From: Randy Poe
- Gaussian to uniform random numbers generator
- Prev by Date: Windows Mixed Language mex S-function build
- Next by Date: HELP: Reading files using dir function
- Previous by thread: Re: Gaussian to uniform random numbers generator
- Next by thread: Re: Gaussian to uniform random numbers generator
- Index(es):
Relevant Pages
|