functionnormalizePLpdf

Normalize a piecewise linear density function given by a list of points

Extends from Function ((Weighted) geometric mean).

Information

This information is part of the Business Simulation Library (BSL). Please support this work and ► donate.

The output y is a normalized piecewise linear probability distribution function specified by a list of points {{x1,f(x1)}, {x2,f(x2}}, ... ,{xn, f(xn)}, where the support may be rescaled to the unit interval (rescaleQ = true) and the area under the curve is equal to one.

Notes

If the normalization constant is not greater than zero, the function will simply return the input, albeit with possibly rescaled first dimension.

Syntax

Functions.normalizePLpdf({{x1,y1},{x2,y2}, ...});          // rescaleQ = true
Functions.normalizePLpdf({{x1,y1},{x2,y2}, ...}, rescaleQ = false);

Examples


normalizePLpdf({{0,2},{5,2},{10,2}});         // {{0,1},{0.5,1},{1,1}}
normalizePLpdf({{0,0},{5,1},{10,0}});         // {{0,0},{0.5,2},{1,0}}
normalizePLpdf({{0,2},{5,2},{10,2}}, false);  // {{0,0.1},{5,0.1},{10,0.1}}

Inputs

TypeNameDefaultDescription
Realx (from geometricMean)Vector input
Realweights (from geometricMean)ones(size(x, 1))Vector of weights
RealplPDFPiecewise linear probability density function, i.e., { p1, p2, ... }
BooleanrescaleQtrue= true, if support is to be rescaled to the unit interval

Outputs

TypeNameDefaultDescription
Realy (from geometricMean)

Revisions

  • Introduced in v2.1.0.