Pergunta

I am trying to model shadowing and fast fading for mobile wireless networks. For fast fading, Rayleigh fading is a reasonable model to use. The envelope of the channel response will be Rayleigh distributed. Calling this random variable R, it will have a probability density function (PDF) of

PR(r) = ((2r)/Ω)*exp(-r^2/Ω), r >= 0, Ω = 2σ^2

http://en.wikipedia.org/wiki/Rayleigh_fading to see the equation written nicely.

So, I have the PDF, now I am just wondering how to get the random variable from it?

I have looked at these questions:

Generate Array of Numbers that fit to a Probability Distribution in Ruby?

Generate Random Numbers with Probabilistic Distribution

but I am still not sure how to do it. It has taken me forever to understand PDF's so if anyone knows a way in Java to get a random variable with a specific PDF, that would be much appreciated!

Foi útil?

Solução

Rayleigh distribution is a special case of the Weibull distribution. If you google around, there are lots of Weibull generators written in Java, for example:

One way to generate a random number from a given distribution is to generate a random number uniformly distributed between zero and one, and apply the target distribution's inverse CDF to that random number. See Wikipedia.

Outras dicas

For your case, something like this:

 Random generator = new Random();
 double r = Math.sqrt(-Omega*Math.log(1-generator.nextDouble()));
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top