Categories &

Functions List

Function Reference: raylpdf

statistics: y = raylpdf (x, sigma)

Rayleigh probability density function (PDF).

For each element of x, compute the probability density function (PDF) of the Rayleigh distribution with scale parameter sigma. The size of p is the common size of x and sigma. A scalar input functions as a constant matrix of the same size as the other inputs.

Further information about the Rayleigh distribution can be found at https://en.wikipedia.org/wiki/Rayleigh_distribution

Input arguments must be double or single; integer, logical, and character arrays are rejected. MATLAB accepts a character array and evaluates it at the character codes, which Octave deliberately does not, since a character array is an integer type and integers are refused too.

The density at an infinite abscissa is 0, no proper distribution placing mass there. MATLAB returns NaN here, as it does for poisspdf and for no other density, which is an inconsistency there rather than a convention: it returns 0 at Inf for every other distribution of the same support.

The prob.RayleighDistribution class names this same parameter B, after MATLAB.

See also: raylcdf, raylinv, raylrnd, raylfit, rayllike, raylstat

Source Code: raylpdf

Plot various PDFs from the Rayleigh distribution

 x = 0:0.01:10;
 y1 = raylpdf (x, 0.5);
 y2 = raylpdf (x, 1);
 y3 = raylpdf (x, 2);
 y4 = raylpdf (x, 3);
 y5 = raylpdf (x, 4);
 plot (x, y1, '-b', x, y2, 'g', x, y3, '-r', x, y4, '-m', x, y5, '-k')
 grid on
 ylim ([0, 1.25])
 legend ({'σ = 0,5', 'σ = 1', 'σ = 2', ...
          'σ = 3', 'σ = 4'}, 'location', 'northeast')
 title ('Rayleigh PDF')
 xlabel ('values in x')
 ylabel ('density')
plotted figure