MATLAB: How to generate a random number in matlab

basicMATLAB

How to generate a random number in matlab?

Best Answer

This is shown in the documentation: doc rand , especially: floating-point-numbers-within-specific-range
a = 0.01;
b = 50;
r = (b-a) * rand + a;
Reading the documentation is a very efficient way to solve such questions. The docs of Matlab are excellent.
Related Question