Thread Subject: Uniform distribution

Subject: Uniform distribution

From: Jason

Date: 17 Apr, 2008 08:56:01

Message: 1 of 4

Hello,

I am currently doing some stats in MATLAB.

I've been using

R = normrnd(mean,sigma,[100 1])

to generate 100 random numbers from a normal distribution
with "mean" and standard deviation "sigma".

I now want to do the same for a uniform distribution.

Is is the case that

R = unifrnd(A.B, [100 1])

is what I should use. Are A and B are the lower and upper
ranges. The help isn't to specific but I'm assuming this is
the case.

Thanks

Subject: Uniform distribution

From: helper

Date: 17 Apr, 2008 09:25:05

Message: 2 of 4

"Jason " <j_henderson44@REMOVEhotmail.com> wrote in message
<fu73b1$gc9$1@fred.mathworks.com>...
> Hello,
>
> I am currently doing some stats in MATLAB.
>
> I've been using
>
> R = normrnd(mean,sigma,[100 1])
>
> to generate 100 random numbers from a normal distribution
> with "mean" and standard deviation "sigma".
>
> I now want to do the same for a uniform distribution.
>
> Is is the case that
>
> R = unifrnd(A.B, [100 1])
>
> is what I should use. Are A and B are the lower and upper
> ranges. The help isn't to specific but I'm assuming this
is
> the case.
>
> Thanks


I agree that the documentation for this function isn't too
specific. One good thing about MATLAB is the fact that you
can open and read many of the functions. If you check out
the code for UNIFRND, you will see it is simply a
fanicified wrapper for the operation:

R = A + (B-A)*rand(m)

where A and B are your lower and upper bounds and m is a 1-
by-2 matrix of sizes [nRows nCols].

Subject: Uniform distribution

From: Jason

Date: 17 Apr, 2008 12:27:01

Message: 3 of 4

"helper " <spamless@nospam.com> wrote in message
<fu751h$qq2$1@fred.mathworks.com>...
> "Jason " <j_henderson44@REMOVEhotmail.com> wrote in message
> <fu73b1$gc9$1@fred.mathworks.com>...
> > Hello,
> >
> > I am currently doing some stats in MATLAB.
> >
> > I've been using
> >
> > R = normrnd(mean,sigma,[100 1])
> >
> > to generate 100 random numbers from a normal distribution
> > with "mean" and standard deviation "sigma".
> >
> > I now want to do the same for a uniform distribution.
> >
> > Is is the case that
> >
> > R = unifrnd(A.B, [100 1])
> >
> > is what I should use. Are A and B are the lower and upper
> > ranges. The help isn't to specific but I'm assuming this
> is
> > the case.
> >
> > Thanks
>
>
> I agree that the documentation for this function isn't too
> specific. One good thing about MATLAB is the fact that you
> can open and read many of the functions. If you check out
> the code for UNIFRND, you will see it is simply a
> fanicified wrapper for the operation:
>
> R = A + (B-A)*rand(m)
>
> where A and B are your lower and upper bounds and m is a 1-
> by-2 matrix of sizes [nRows nCols].
>
>


Many thanks. I ended up plotting it to check. I wasn't aware
I could open the code to check it. How would I do this?

Thanks.

Subject: Uniform distribution

From: Jason

Date: 17 Apr, 2008 12:42:02

Message: 4 of 4

"Jason " <j_henderson44@REMOVEhotmail.com> wrote in message
>
> Many thanks. I ended up plotting it to check. I wasn't aware
> I could open the code to check it. How would I do this?
>
> Thanks.

Oops forget that. Fairly obvious. Thanks for suggestion.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
unifrnd helper 17 Apr, 2008 05:30:08
distribution ra... Jason 17 Apr, 2008 05:00:05
rssFeed for this Thread

Contact us at files@mathworks.com