フィルターのクリア

Creating random non-discrete values and assigning weights

1 回表示 (過去 30 日間)
Tanvir ALLIDINA
Tanvir ALLIDINA 2021 年 3 月 31 日
編集済み: Matt J 2021 年 4 月 5 日
Hello ,
I want to create a random set of numbers from 0-90, these numbers need to include non-discrete values eg 20.5 etc.
once these values are selected I want create weights for each as shown below:
[0-10]= 0.05
[11-20]= 0.1
[21-30]= 0.1
[31-40]= 0.25
[41-50]= 0.2
[51-60]= 0.1
[61-70]= 0.1
[71-80] = 0.05
[81-90]= 0.05
any help would be greatly appreciated
  1 件のコメント
Aditya Patil
Aditya Patil 2021 年 4 月 5 日
How do you decide the weight values?

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

採用された回答

Matt J
Matt J 2021 年 4 月 5 日
編集済み: Matt J 2021 年 4 月 5 日
As an example,
weightList=[0.4 , 0.1, 0.3, 0.2];
x=rand(1,6)*40,
x = 1×6
20.7401 38.8661 21.3656 23.9506 2.4322 26.9903
Weights = weightList(discretize(x,0:10:40))
Weights = 1×6
0.3000 0.2000 0.3000 0.3000 0.4000 0.3000

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by