Path: news.mathworks.com!not-for-mail
From: "AMMAL " <alanazi@ualberta.ca>
Newsgroups: comp.soft-sys.matlab
Subject: Re: random number generation
Date: Tue, 18 Mar 2008 20:17:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 57
Message-ID: <frp7vt$csg$1@fred.mathworks.com>
References: <frp525$8i$1@fred.mathworks.com> <frp5u9$dfo$1@fred.mathworks.com> <8r60u3p6eauu99plunl4oo31dd1o242jq2@4ax.com>
Reply-To: "AMMAL " <alanazi@ualberta.ca>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1205871421 13200 172.30.248.37 (18 Mar 2008 20:17:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 18 Mar 2008 20:17:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 895852
Xref: news.mathworks.com comp.soft-sys.matlab:457926


Thank you all for your answer,
I am wondering now how i would include the codition 
statement you wrote in the block code to ensure the samples 
are positive.Could you please show me how to include it in 
a for loop maybe. 

Thanks,
Ammal 

richardstartz@comcast.net wrote in message 
<8r60u3p6eauu99plunl4oo31dd1o242jq2@4ax.com>...
> 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