How to generate a random number in matlab?

조회 수: 4 (최근 30일)
Walshaikhli
Walshaikhli 2015년 3월 8일
편집: Walshaikhli 2017년 3월 27일
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

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by