Class CenterOfGravity

  • Direct Known Subclasses:
    CenterOfArea

    public class CenterOfGravity
    extends Defuzzifier
    Defuzzifier method that calculates the center of gravity of given function. Formally the center of gravity is Integral(x.f(x)) / Integral(f(x)) for the whole interval. This implementation uses Riemann's sums to calculate the integrals of both functions.
    • Constructor Summary

      Constructors 
      Constructor Description
      CenterOfGravity()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getValue​(java.util.List<java.awt.geom.Point2D.Double> function)
      Implements the center of gravity by calculating the Riemann's sums of the area using the trapezoidal rule.
      protected double riemmanSum​(java.util.List<java.awt.geom.Point2D.Double> function)  
      protected double riemmanSum​(java.util.List<java.awt.geom.Point2D.Double> function, double maxX)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CenterOfGravity

        public CenterOfGravity()
    • Method Detail

      • getValue

        public double getValue​(java.util.List<java.awt.geom.Point2D.Double> function)
        Implements the center of gravity by calculating the Riemann's sums of the area using the trapezoidal rule. It assumes the x points are equally spaced across the whole domain of the function.
        Specified by:
        getValue in class Defuzzifier
        Parameters:
        function - the list of points [x, f(x)] representing the function to analyze.
        Returns:
        the center of gravity of the function.
      • riemmanSum

        protected double riemmanSum​(java.util.List<java.awt.geom.Point2D.Double> function)
      • riemmanSum

        protected double riemmanSum​(java.util.List<java.awt.geom.Point2D.Double> function,
                                    double maxX)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object