Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Uniform distribution
Date: Thu, 17 Apr 2008 09:25:05 +0000 (UTC)
Organization: Timothy S. Farajian, Inc.
Lines: 39
Message-ID: <fu751h$qq2$1@fred.mathworks.com>
References: <fu73b1$gc9$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1208424305 27458 172.30.248.37 (17 Apr 2008 09:25:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 17 Apr 2008 09:25:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1272923
Xref: news.mathworks.com comp.soft-sys.matlab:463558



"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].