Revision as of 14:49, 15 April 2013 by Zhang536 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

1. Generating uniformly distributed random numbers between 0 and 1: U(0,1)

a) Using matlab functions

The rand function returns uniformly distributed random numbers between 0 and 1.

r = rand(n) returns an n-by-n matrix containing pseudorandom values drawn from the standard uniform distribution on the open interval (0,1). r = rand(m,n) or r = rand([m,n]) returns an m-by-n matrix.

Example: rand(1, 5)

ans = 0.8147 0.9058 0.127 0.9134 0.6324

Alumni Liaison

Prof. Math. Ohio State and Associate Dean
Outstanding Alumnus Purdue Math 2008

Jeff McNeal