Categories &

Functions List

Function Reference: tricdf

statistics: p = tricdf (x, a, b, c)
statistics: p = tricdf (x, a, b, c, "upper")

Triangular cumulative distribution function (CDF).

For each element of x, compute the cumulative distribution function (CDF) of the triangular distribution with lower limit parameter a, peak location (mode) parameter b, and upper limit parameter c. The size of p is the common size of the input arguments. A scalar input functions as a constant matrix of the same size as the other inputs.

p = tricdf (x, a, b, c, "upper") computes the upper tail probability of the triangular distribution with parameters a, b, and c, at the values in x.

Note that the order of the parameter input arguments has been changed after statistics version 1.6.3 in order to be MATLAB compatible with the parameters used in the TriangularDistribution probability distribution object. More specifically, the positions of the parameters b and c have been swapped. As a result, the naming conventions no longer coinside with those used in Wikipedia, in which b denotes the upper limit and c denotes the mode or peak parameter.

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

See also: triinv, tripdf, trirnd, tristat

Source Code: tricdf

Example: 1

 

 ## Plot various CDFs from the triangular distribution
 x = 0.001:0.001:10;
 p1 = tricdf (x, 3, 4, 6);
 p2 = tricdf (x, 1, 2, 5);
 p3 = tricdf (x, 2, 3, 9);
 p4 = tricdf (x, 2, 5, 9);
 plot (x, p1, "-b", x, p2, "-g", x, p3, "-r", x, p4, "-c")
 grid on
 xlim ([0, 10])
 legend ({"a = 3, b = 4, c = 6", "a = 1, b = 2, c = 5", ...
          "a = 2, b = 3, c = 9", "a = 2, b = 5, c = 9"}, ...
         "location", "southeast")
 title ("Triangular CDF")
 xlabel ("values in x")
 ylabel ("probability")

                    
plotted figure