Effacer les filtres
Effacer les filtres

How can I allocate chances to a distribution

1 vue (au cours des 30 derniers jours)
Ruben Verkempynck
Ruben Verkempynck le 4 Mai 2011
Hi guys,
I know the function rand() gives a parameter a range with a uniform distribution. How can I bias this distribution (read: not a uniform distribution) that the lowest part of the range is sampled more often, or the top part, etc.
Thanks, Ruben

Réponse acceptée

Oleg Komarov
Oleg Komarov le 4 Mai 2011
rnd = rand(100,1)*100;
% Oversample interval [a b] = [80 100]
a = 80;
b = 100;
rnd = [rnd; a + (b-a)*rand(100,1)];
scatter(rnd,ones(200,1),'.')

Plus de réponses (0)

Catégories

En savoir plus sur Random Number Generation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by