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$>
References: <jf75ia$oc4$> <jf7812$3ea$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1326927010 9247 (18 Jan 2012 22:50:10 GMT)
NNTP-Posting-Date: Wed, 18 Jan 2012 22:50:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3276625
Xref: comp.soft-sys.matlab:755088

"Roger Stafford" wrote in message <jf7812$3ea$>...
> "Chelsea " <> wrote in message <jf75ia$oc4$>...
> > 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.