How to generate a random number in matlab?

 Accepted Answer

Jan
Jan on 8 Mar 2015
Edited: Jan on 8 Mar 2015
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.

More Answers (1)

Categories

Find more on Random Number Generation in Help Center and File Exchange

Products

Tags

Asked:

on 8 Mar 2015

Edited:

on 27 Mar 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!