Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: how to generate a gaussian distribution using random number generator
Replies: 3   Last Post: Jul 8, 2013 2:10 PM

 Messages: [ Previous | Next ]
 dpb Posts: 9,850 Registered: 6/7/07
Re: how to generate a gaussian distribution using random number generator
Posted: Jul 3, 2013 8:48 PM

On 7/3/2013 6:52 PM, faraz.a wrote:
> i want to generate 50,000 samples according to the gaussian distribution
> using random number generator where sigma=1 and mean=0 X is a normally
> distributed random variable N(0,?2). mean=0 variance=1
>
> I did this R=randn(50000)
>
> i got an error
>
> Error using randn
> Out of memory. Type HELP MEMORY for your options.

doc randn

You tried to generate 50K x 50K array which is ~19 GB

> and if i am using R=randn(50000,1);
> hist(R)
>
> this generated a distribution but the y label was ranging from -4 to 5.
> I want it from -infinity to +infinity
> how to do that?

What's the probability of getting either extreme from a sample from a
standard normal distribution?

For that matter, what's the probability of |z|>5? How does that compare
w/ the size of the sample generated?

--

Date Subject Author
7/3/13 faraz.a
7/3/13 dpb
7/3/13 dpb
7/8/13 Steven Lord