.BusinessSimulation.Functions.trapmf

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 trapezoidal function given the real input x and the parameters lower bound of the support a, the lower bound of the core b, the upper bound of the core c, and the upper bound of the support d.

Implementation


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

Syntax

Functions.trapmf(x, a, b, c, d);

Examples


Functions.trapmf( 5, a=2, b=4, c=6, d=8); // 1.0 Functions.trapmf( 2, a=2, b=4, c=6, d=8); // 0.0 Functions.trapmf( 9, a=2, b=4, c=6, d=8); // 0.0 Functions.trapmf( 7, a=2, b=4, c=6, d=8); // 0.5

See also

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

Interface

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

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