MATLAB: How to generate an array of random values between -0.5 and 0.5

random - range

How to generate an array of random values between -0.5 and 0.5 ?

Best Answer

Did you look at the help for rand? The second example says this:
In general, you can generate N random numbers in the interval (a,b) with the formula r = a + (b-a).*rand(N,1).
Did you try that?