MATLAB: How to create a column vector of random numbers with interval [-0.1;0.1], with N elements

double random sequenceMATLAB and Simulink Student Suite

I need to create random sequence uniformly distributed in [−∆e, ∆e] for different value of ∆e from 0.1 to 100. Probably for interval with integer numbers [-5,5] I can apply randi([-5 5],N,1). But how can I do this trick with double numbers?

Best Answer

N = whatever
de = whatever
result = rand(N,1)*(2*de) - de;