Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: vector of random unifromly spaced numbers on a given interval
Date: Wed, 18 Jan 2012 22:50:10 +0000 (UTC)
Organization: Georgia Institute of Technology
Lines: 21
Message-ID: <jf7ib2$90v$1@newscl01ah.mathworks.com>
References: <jf75ia$oc4$1@newscl01ah.mathworks.com> <jf7812$3ea$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-04-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1326927010 9247 172.30.248.35 (18 Jan 2012 22:50:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 18 Jan 2012 22:50:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3276625
Xref: news.mathworks.com comp.soft-sys.matlab:755088

"Roger Stafford" wrote in message <jf7812$3ea$1@newscl01ah.mathworks.com>...
> "Chelsea " <brass4all@gmail.com> wrote in message <jf75ia$oc4$1@newscl01ah.mathworks.com>...
> > Hello, I have to create a vector of given length that is made up of randomly generated, uniformly spaced numbers from 2 to 9. How would I go about doing this? I can only use one line to do so :/ Please help
> > 
> > Thank you!
> - - - - - - - -
>   Strictly speaking the terms "randomly generated" and "uniformly spaced" are mutually incompatible.  Perhaps you mean possessing a statistically uniform distribution on the interval [2,9].  If so do this:
> 
>  v = (9-2)*rand(n,1)+2;
> 
> where n is the desired length.
> 
>   If you mean anything else, you need to describe it more accurately than you have.
> 
> Roger Stafford

Roger, She actually put it virtually ver batim, it just needs to be transposed in addition to what she already stated.  It is an "essentials" question from our 2nd homework assignment.  Use of rand will solve the problem.

Chelsea,  try using the Piazza set up for the course, it will yield better results to hw inquiries, and quicker.  Use the help command in your matlab command window to see how to properly use the rand function.  It should help you get the correct answer quickly.

Bryan