Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!news.glorb.com!postnews.google.com!s50g2000hsb.googlegroups.com!not-for-mail
From: Greg Heath <heath@alumni.brown.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: random number generation
Date: Wed, 19 Mar 2008 07:01:56 -0700 (PDT)
Organization: http://groups.google.com
Lines: 50
Message-ID: <8afa9e3e-4597-43db-8879-7ba5c01f344a@s50g2000hsb.googlegroups.com>
References: <frp525$8i$1@fred.mathworks.com> <frp5u9$dfo$1@fred.mathworks.com> 
NNTP-Posting-Host: 68.39.98.10
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1205935316 21116 127.0.0.1 (19 Mar 2008 14:01:56 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 19 Mar 2008 14:01:56 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: s50g2000hsb.googlegroups.com; posting-host=68.39.98.10; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 
Xref: news.mathworks.com comp.soft-sys.matlab:458053


On Mar 18, 3:46=A0pm, richardsta...@comcast.net wrote:
> On Tue, 18 Mar 2008 19:42:01 +0000 (UTC), "Roger Stafford"
>
>
>
>
>
> <ellieandrogerxy...@mindspring.com.invalid> wrote:
> >"AMMAL " <alan...@ualberta.ca> wrote in message <frp525$8i
> >$...@fred.mathworks.com>...
> >> Hellow everybody,
>
> >> I need a hand on how to generate a 100 positive numbers
> >> that follow a normal distribution curve (Bell Shape).In
> >> otherwords, if i histogram the data, a bell shape will be
> >> generated. i am not transforming my data, instead, i want
> >> to generate a posirtive one hundred values that will follow
> >> a bell shape.
>
> >> Thanks,
> >> Ammal
> >------
> > =A0You can use "s*randn(1,100)+m" to generate a hundred normal distribut=
ion
> >numbers with mean m and standard deviation s, but you cannot be sure all =
of
> >them will be positive. =A0You cannot have a normal distribution and at th=
e same
> >time have only positive numbers. =A0That is a contradiction in terms. =A0=
The "bell
> >shape" extends all the way to minus and plus infinity.
>
> >Roger Stafford
>
> Roger's advice is correct of course.
> Having said that, you can insure that a *sample*is entirely positive.
> For example:
> x =3D s*randn(1,100)+m;
> if min(x)<0
> =A0x =3D x + abs(min(x));
> end

Alternatively, you can reject negative values
and keep generating until you have 100.

In either case, the resulting distribution is ...

ABNORMAL! (;>)

Greg