Main Content

raylpdf

Rayleigh probability density function

Description

p = raylpdf(x,b) returns the Rayleigh probability density function (pdf) with the scale parameter b, evaluated at the values in x.

example

Examples

collapse all

Compute the Rayleigh probability density function (pdf) with the scale parameter b=0.5 for values between x=0 and x=2.

x = 0:0.01:2;
p = raylpdf(x,0.5);

Plot the pdf.

figure;
plot(x,p)
grid on
xlabel("x")
ylabel("p")

Figure contains an axes object. The axes object with xlabel x, ylabel p contains an object of type line.

Input Arguments

collapse all

Values at which to evaluate the Rayleigh pdf, specified as a nonnegative scalar value or an array of nonnegative scalar values.

To evaluate the pdf at multiple values, specify x as an array. To evaluate the pdfs of multiple distributions, specify b as an array. If x and b are both arrays, they must have the same size. If only x or b is an array, raylpdf expands the other input argument into a constant array of the same size as the array input. Each element in p is the pdf value of the distribution specified by the corresponding element in b, evaluated at the corresponding element in x.

Data Types: single | double

Scale parameter, specified as a positive scalar value or an array of positive scalar values.

To evaluate the pdf at multiple values, specify x as an array. To evaluate the pdfs of multiple distributions, specify b as an array. If x and b are both arrays, they must have the same size. If only x or b is an array, raylpdf expands the other input argument into a constant array of the same size as the array input. Each element in p is the pdf value of the distribution specified by the corresponding element in b, evaluated at the corresponding element in x.

Data Types: single | double

Output Arguments

collapse all

Rayleigh pdf values, returned as a scalar value or an array of scalar values. p is the same size as x and b after any necessary scalar expansion. Each element in p is the pdf value of the distribution specified by the corresponding elements in b, evaluated at the corresponding element in x.

More About

collapse all

Alternative Functionality

  • raylpdf is a function specific to the Rayleigh distribution. Statistics and Machine Learning Toolbox™ also offers the generic function pdf, which supports various probability distributions. To use pdf, create a RayleighDistribution probability distribution object and pass the object as an input argument or specify the probability distribution name and its parameters. Note that the distribution-specific function raylpdf is faster than the generic function cdf.

  • Use the Probability Distribution Function Tool to create an interactive plot of the cumulative distribution function (cdf) or probability density function (pdf) for a probability distribution.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a