Assembly: AForge.Fuzzy (in AForge.Fuzzy.dll) Version: 18.104.22.168 (22.214.171.124)
public class PiecewiseLinearFunction : IMembershipFunction
The piecewise linear is a generic function used by many specific fuzzy membership functions, like the trappezoidal function. This class must be instantiated with a sequence of points representing the edges of each one of the lines composing the piecewise function.
While trapezoidal and half trapezoidal are classic functions used in fuzzy functions, this class supports any function or approximation that can be represented as a sequence of lines.
// creating an array of points representing a typical trapezoidal function /-\ Point  points = new Point; // point where membership starts to rise points = new Point( 10, 0 ); // maximum membership (1) reached at the second point points = new Point( 20, 1 ); // membership starts to fall at the third point points = new Point( 30, 1 ); // membership gets to zero at the last point points = new Point( 40, 0 ); // creating the instance PiecewiseLinearFunction membershipFunction = new PiecewiseLinearFunction( points ); // getting membership for several points for ( int i = 5; i < 45; i++ ) Console.WriteLine( membershipFunction.GetMembership( i ) );