How am I to generate random numbers with exponential distribution applied?

How to generate random numbers with the exponential distribution applied, and also given a minimum value of 0.5, and a lambda of 0.2?

 Respuesta aceptada

pd = makedist('Exponential','mu', 0.2);
r=0.5+random(pd)
but this gives you values with 0.5 + a random number if you want just the numbers that are bigger than 0.5 do this:
pd = makedist('Exponential','mu', 0.2);
r=0;
while r<0.5
r=random(pd);
end

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Centro de ayuda y File Exchange.

Preguntada:

el 30 de Abr. de 2015

Respondida:

el 30 de Abr. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by