Method to get object based on probability distribution

1 vue (au cours des 30 derniers jours)
Masood Abbasi
Masood Abbasi le 30 Oct 2018
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?

Réponses (1)

Jeff Miller
Jeff Miller le 30 Oct 2018
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