Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 18 Mar 2008 14:46:08 -0500
From: richardstartz@comcast.net
Newsgroups: comp.soft-sys.matlab
Subject: Re: random number generation
Date: Tue, 18 Mar 2008 12:46:06 -0700
Message-ID: <8r60u3p6eauu99plunl4oo31dd1o242jq2@4ax.com>
References: <frp525$8i$1@fred.mathworks.com> <frp5u9$dfo$1@fred.mathworks.com>
X-Newsreader: Forte Agent 3.3/32.846
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 34
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 67.183.112.173
X-Trace: sv3-SY811OYnG/9EZMRsT+0iiPV+NW3Y+BybnQKFUgJT2vE5AbGnbm5D64n1gFIDcLBRr0Ikw7ZIkJKm38x!HFn+oPRvE+0puGNJ2c1F21vtB29Mh6BNXVEht+no9/eNg7caZG++U0PJke8qZreCeNqu1hsSUmje!1kXILM0oTlBXfoscQxYv5cxD88AB
X-Complaints-To: abuse@comcast.net
X-DMCA-Complaints-To: dmca@comcast.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.37
Bytes: 2354
Xref: news.mathworks.com comp.soft-sys.matlab:457920


On Tue, 18 Mar 2008 19:42:01 +0000 (UTC), "Roger Stafford"
<ellieandrogerxyzzy@mindspring.com.invalid> wrote:

>"AMMAL " <alanazi@ualberta.ca> wrote in message <frp525$8i
>$1@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
>------
>  You can use "s*randn(1,100)+m" to generate a hundred normal distribution 
>numbers with mean m and standard deviation s, but you cannot be sure all of 
>them will be positive.  You cannot have a normal distribution and at the same 
>time have only positive numbers.  That is a contradiction in terms.  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 = s*randn(1,100)+m;
if min(x)<0
 x = x + abs(min(x));
end

-Dick Startz