How to declare Rayleigh random variables ?

4 views (last 30 days)
charu shree
charu shree on 7 Apr 2023
Answered: Image Analyst on 7 Apr 2023
Hello all, how to declare Rayleigh random variables in the following case:
Suppose we have two vectors, "sr" vector is of source and "ta" vector is of target as shown below.
My query is that how we can have Rayleigh random variable between each elements of two vectors.
Any help in this regard will be highly appreciated.
sr = [1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4]; % various possible sources
ta = [2 3 4 5 1 3 4 5 1 2 4 5 1 2 3 5]; % various possible targets

Answers (1)

Image Analyst
Image Analyst on 7 Apr 2023
Did you try random in the Statistics and Machine Learning Toolbox. It can produce random numbers drawn from a Rayleigh distribution.
help random
RANDOM Generate random arrays from a specified distribution. R = RANDOM(NAME,A) returns an array of random numbers chosen from the one-parameter probability distribution specified by NAME with parameter values A. R = RANDOM(NAME,A,B) or R = RANDOM(NAME,A,B,C) returns an array of random numbers chosen from a two- or three-parameter probability distribution with parameter values A, B (and C). The size of R is the common size of the input arguments. A scalar input functions as a constant matrix of the same size as the other inputs. R = RANDOM(NAME,A,M,N,...) or R = RANDOM(NAME,A,[M,N,...]) returns an M-by-N-by-... array of random numbers for a one-parameter distribution. Similarly, R = RANDOM(NAME,A,B,M,N,...) or R = RANDOM(NAME,A,B,[M,N,...]), and R = RANDOM(NAME,A,B,C,M,N,...) or R = RANDOM(NAME,A,B,C,[M,N,...]), return an M-by-N-by-... array of random numbers for a two- or three-parameter distribution. NAME can be: 'beta' or 'Beta', 'bino' or 'Binomial', 'burr' or 'Burr', 'chi2' or 'Chisquare', 'exp' or 'Exponential', 'ev' or 'Extreme Value', 'f' or 'F', 'gam' or 'Gamma', 'gev' or 'Generalized Extreme Value', 'gp' or 'Generalized Pareto', 'geo' or 'Geometric', 'hn' or 'Half Normal', 'hyge' or 'Hypergeometric', 'logn' or 'Lognormal', 'nbin' or 'Negative Binomial', 'ncf' or 'Noncentral F', 'nct' or 'Noncentral t', 'ncx2' or 'Noncentral Chi-square', 'norm' or 'Normal', 'poiss' or 'Poisson', 'rayl' or 'Rayleigh', 'stable'or 'Stable', 't' or 'T', 'unif' or 'Uniform', 'unid' or 'Discrete Uniform', 'wbl' or 'Weibull'. Partial matches are allowed and case is ignored. RANDOM is a generic function that accepts a distribution by name. It is faster to use a more specialized function when possible, such as RANDN or NORMRND for the normal distribution. See also CDF, ICDF, MLE, PDF. Documentation for random doc stats/prob.NormalDistribution/random Other uses of random classreg.regr.CompactGeneralizedLinearModel/random classreg.regr.CompactLinearModel/random GeneralizedLinearMixedModel/random gmdistribution/random LeastSquaresResults/random LinearMixedModel/random MultinomialRegression/random NLMEResults/random NonLinearModel/random piecewisedistribution/random prob.NormalDistribution/random prob.ProbabilityDistribution/random prob.UnivariateDistribution/random RepeatedMeasuresModel/random
Otherwise see my attached demo.

Community Treasure Hunt

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

Start Hunting!