plpdf
Piecewise linear probability density function (PDF).
For each element of data, compute the probability density function (PDF) of the piecewise linear distribution with a vector of x values at which the CDF changes slope and a vector of CDF values Fx that correspond to each value in x. Both x and Fx must be vectors of the same size and at least 2-elements long. The size of p is the same as data.
Further information about the piecewise linear distribution can be found at https://en.wikipedia.org/wiki/Piecewise_linear_function
See also: plcdf, plinv, plrnd, plstat
Source Code: plpdf
## Plot various PDFs from the Piecewise linear distribution
data = 0:0.01:10;
x1 = [0, 1, 3, 4, 7, 10];
Fx1 = [0, 0.2, 0.5, 0.6, 0.7, 1];
x2 = [0, 2, 5, 6, 7, 8];
Fx2 = [0, 0.1, 0.3, 0.6, 0.9, 1];
y1 = plpdf (data, x1, Fx1);
y2 = plpdf (data, x2, Fx2);
plot (data, y1, "-b", data, y2, "g")
grid on
ylim ([0, 0.6])
xlim ([0, 10])
legend ({"x1, Fx1", "x2, Fx2"}, "location", "northeast")
title ("Piecewise linear CDF")
xlabel ("values in data")
ylabel ("density")
|