How to generate a random number in matlab?

2 次查看(过去 30 天)
How to generate a random number in matlab?

采纳的回答

Jan
Jan 2015-3-8
编辑:Jan 2015-3-8
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.

更多回答(1 个)

Konstantinos Sofos
Konstantinos Sofos 2015-3-10
Hi,
myrandom = randi([0.01,50],1,1);
Mathworks documentation is excellent!
Regards

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by