laplacepdf
Laplace probability density function (PDF).
For each element of x, compute the probability density function (PDF) of the Laplace distribution with location parameter mu and scale parameter (i.e. "diversity") beta. The size of y is the common size of x, mu, and beta. A scalar input functions as a constant matrix of the same size as the other inputs.
Both parameters must be reals and beta > 0
.
For beta <= 0
, NaN
is returned.
Further information about the Laplace distribution can be found at https://en.wikipedia.org/wiki/Laplace_distribution
See also: laplacecdf, laplacepdf, laplacernd
Source Code: laplacepdf
## Plot various PDFs from the Laplace distribution x = -10:0.01:10; y1 = laplacepdf (x, 0, 1); y2 = laplacepdf (x, 0, 2); y3 = laplacepdf (x, 0, 4); y4 = laplacepdf (x, -5, 4); plot (x, y1, "-b", x, y2, "-g", x, y3, "-r", x, y4, "-c") grid on xlim ([-10, 10]) ylim ([0, 0.6]) legend ({"μ = 0, β = 1", "μ = 0, β = 2", ... "μ = 0, β = 4", "μ = -5, β = 4"}, "location", "northeast") title ("Laplace PDF") xlabel ("values in x") ylabel ("density") |