How to generate Rayleigh distributed random variable with a specified mean and variance?
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
For example:
x = mu + std*randn(row,col);
The above code generates a Gaussian random variable with mean mu and standard deviation std. Is there a way to do this for a Rayleigh distribution?
0 Kommentare
Antworten (3)
possibility
am 7 Feb. 2018
Hey,
There is an easy method to generate values from a Rayleigh distribution.
Assume Z~Rayleigh(sigma). Since
Z=sqrt(X^2 + Y^2)
where X~N(0,sigma^2) and Y~N(0,sigma^2) independent random variables. So,
z= abs(sigma*randn(1)+1i*sigma*randn(1))
will generate a value from a Rayleigh distribution with parameter sigma.
I know it is quite late but may help someone else :)
0 Kommentare
Image Analyst
am 23 Mai 2016
You can use random() in the Statistics and Machine Learning Toolbox - it has lots of distributions in it. For Rayleigh it says:
The Rayleigh distribution is a special case of the Weibull distribution. If A and B are the parameters of the Weibull distribution, then the Rayleigh distribution with parameter b is equivalent to the Weibull distribution with parameters........
Since what John says is correct, maybe you can use a Weibull distribution???
If you don' thave that toolbox, see my attached Rayleigh demo.
0 Kommentare
John D'Errico
am 22 Mai 2016
Bearbeitet: John D'Errico
am 22 Mai 2016
Um, you can't. A classic Rayleigh distribution has ONE parameter. Call it sigma.
https://en.wikipedia.org/wiki/Rayleigh_distribution
The mean is:
sqrt(pi/2)*sigma
The variance is:
(4-pi)/2*sigma^2
If you wish to match TWO parameters, the mean and variance, you won't in general be able to get both right, at least unless you are very lucky in your choice of the mean and variance.
If you choose some non-standard Rayleigh that has two parameters, depending on what they are, you may have a chance.
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!