How to generate a random number in matlab?

5 Ansichten (letzte 30 Tage)
Walshaikhli
Walshaikhli am 8 Mär. 2015
Bearbeitet: Walshaikhli am 27 Mär. 2017
How to generate a random number in matlab?

Akzeptierte Antwort

Jan
Jan am 8 Mär. 2015
Bearbeitet: Jan am 8 Mär. 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.

Weitere Antworten (1)

Konstantinos Sofos
Konstantinos Sofos am 10 Mär. 2015
Hi,
myrandom = randi([0.01,50],1,1);
Mathworks documentation is excellent!
Regards

Kategorien

Mehr zu Random Number Generation finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by