.BusinessSimulation.Functions.trimf

Information

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

The function returns the degree of membership using a triangular function given the real input x and the parameters lower bound of the support a, the upper bound of the support c and the peak or core value b.

Implementation


y := max(min((x - a) / (b - a), (c - x) / (c - b)), 0);

Syntax

Functions.trimf(x, a, b, c);

Examples


Functions.trimf( 5, a=2, b=5, c=8); // 1.0 Functions.trimf( 1, a=2, b=5, c=8); // 0.0 Functions.trimf( 9, a=2, b=5, c=8); // 0.0

See also

evalmf, rampmf, trapmf, smf, sigmf, pimf, psigmf, gaussmf, gbellmf

Interface

function trimf
  extends BusinessSimulation.Icons.Function;
  input Real x "Input value for which the degree of membership is to be computed";
  input Real a "Lower bound (i.e., f(a) = 0)";
  input Real b "Peak (i.e., f(b) = 1)";
  input Real c "Upper bound (i.e., f(c) = 0)";
  output Real y "Degree of membership";
end trimf;

Generated at 2024-11-20T19:25:51Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos