Categories &

Functions List

Function Reference: laplacecdf

statistics: p = laplacecdf (x, mu, beta)
statistics: p = laplacecdf (x, mu, beta, "upper")

Laplace cumulative distribution function (CDF).

For each element of x, compute the cumulative distribution function (CDF) of the Laplace distribution with location parameter mu and scale parameter (i.e. "diversity") beta. The size of p 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.

p = laplacecdf (x, mu, beta, "upper") computes the upper tail probability of the Laplace distribution with parameters mu and beta, at the values in x.

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

See also: laplaceinv, laplacepdf, laplacernd

Source Code: laplacecdf

Example: 1

 

 ## Plot various CDFs from the Laplace distribution
 x = -10:0.01:10;
 p1 = laplacecdf (x, 0, 1);
 p2 = laplacecdf (x, 0, 2);
 p3 = laplacecdf (x, 0, 4);
 p4 = laplacecdf (x, -5, 4);
 plot (x, p1, "-b", x, p2, "-g", x, p3, "-r", x, p4, "-c")
 grid on
 xlim ([-10, 10])
 legend ({"μ = 0, β = 1", "μ = 0, β = 2", ...
          "μ = 0, β = 4", "μ = -5, β = 4"}, "location", "southeast")
 title ("Laplace CDF")
 xlabel ("values in x")
 ylabel ("probability")

                    
plotted figure