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.
On Mar 18, 3:27 pm, "AMMAL " <alan...@ualberta.ca> wrote:
> 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
The function RANDN will generate samples from a
standard normal distribution. Note that if you histogram
the results, you won't get a perfect bell shape since samples,
being random, have a little variation in them. The mean
of your samples won't be exactly 0, but something close.
The variance won't be exactly 1, but something close.
That's the nature of random variables and samples.
"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.
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
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
"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
Hello
I am not sure about the Bell thing, but if you want to
generate 100 random positive numbers then you can use this
n = 100;
f = ceil(n.*rand(100,1));
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.
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.