Matlab, matrix containing random numbers within specified range
I am absolutely new to Matlab and am trying to create an m-by-n matrix containing numbers within a specified range (ie. between -1 and 1). Is there an equivalent function to rand(m, n) where I can specify the range myself or would I need to explicitely create a bunch of random numbers (as ie. was described in this answer ) and create a matrix from them? Any pointers to relevant Documentation, etc. highly appreciated. This is straight from Matlab's documentation for rand . Is this want you want? Example 1 Generate values from the uniform distribution on the interval [a, b]: r = a + (b-a).*rand