How to generate a random number in matlab?

2 visualizaciones (últimos 30 días)
Walshaikhli
Walshaikhli el 8 de Mzo. de 2015
Editada: Walshaikhli el 27 de Mzo. de 2017
How to generate a random number in matlab?

Respuesta aceptada

Jan
Jan el 8 de Mzo. de 2015
Editada: Jan el 8 de Mzo. de 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.

Más respuestas (1)

Konstantinos Sofos
Konstantinos Sofos el 10 de Mzo. de 2015
Hi,
myrandom = randi([0.01,50],1,1);
Mathworks documentation is excellent!
Regards

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by