Hello every one, How can I generate randomly only one number between two values (e.g.: 0.01-1)each time?

2 ビュー (過去 30 日間)
a=ran(0.2,1.12)
b= ran(0.01,0.1)
function T = ran(min,max)
T= fix((max-min).*rand(1,1) + min)+1;
end
This code doesn't give me real number, It just give only integer number.
for example i want give me for a= 0.5 or 1.11 or any real number, and same for b=0.02 or 0.06 and so on.
i have use this code in this code: new{'LTE','Jitter'}=ran(0.6,4);
Thank you in advanced

採用された回答

Walter Roberson
Walter Roberson 2022 年 1 月 22 日
Remove the fix() call. fix() asks to take the integer portion of the value (rounding towards 0)
  4 件のコメント
ARAM KHURSHEED
ARAM KHURSHEED 2022 年 1 月 23 日
Dear @Walter Roberson, it's work now
Thank you so much :)
Best Regards

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by