How to do inverse tranform in dice throw simulate?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/949819/image.png)
Hi so I'm trying to simulated loaded dice throw and do a inverse transform, here's my code so far:
a = [0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125];
cdf = cumsum(a);
u = rand(); % assume u = 0.5
b = sum(cdf <= u) + 1
What should I do next for the inverse transform, and do I need a for loop?
2 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Adding custom doc in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!