Method to get object based on probability distribution

1 回表示 (過去 30 日間)
Masood Abbasi
Masood Abbasi 2018 年 10 月 30 日
回答済み: Jeff Miller 2018 年 10 月 30 日
Hi
I need to implement a network protocol slot selection mechanism as described in this research paper( Sift: A MAC Protocol for Event-Driven Wireless Sensor Networks ) where each slot from 1 to Cw like (1 to 10 when Cw=10) has increasing geometric non uniform probability distribution. Alpha is b/w 0.7 and 0.8, r is slot number from 1 to 10.
The probability mass function Pr has values greater than 1 and it equals as shown in figure
I have to now write a function that should give me a slot from (1 to 10), when called, each time but as slots from 1 to 10 has increasing probability of selection then one would expect that 10 would be given more preference then 1 and the function must give values according to probability of each slot from 1 to 10. So how could i write this logic?
Is fitting in any one distribution like exponential necessary? . Even after determining that if this fits in exponential distribution with mu 'x' how can i let my function choose (randomly) slot with biasing to higher number of slots then starting ones?

回答 (1 件)

Jeff Miller
Jeff Miller 2018 年 10 月 30 日
It is easy using the List distribution in the Cupid toolbox:
cw = 10;
r = 1:cw;
alpha = .75;
pr = (1-alpha)*alpha^cw / (1 - alpha^cw) * alpha.^(-r);
slot=List(r,pr);
rands = slot.Random(10000,1);
histogram(rands);

Community Treasure Hunt

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

Start Hunting!

Translated by