Octave Fuzzy Logic Toolkit: defuzz

### Function Reference: `defuzz`

Function File: crisp_x = defuzz (x, y, defuzz_method)
Function File: crisp_x = defuzz ([x1 x2 ... xn], [y1 y2 ... yn], defuzz_method)

For a given domain, set of fuzzy function values, and defuzzification method, return the defuzzified (crisp) value of the fuzzy function.

The arguments x and y must be either two real numbers or two equal-length, non-empty vectors of reals, with the elements of x strictly increasing. defuzz_method must be a (case-sensitive) string corresponding to a defuzzification method. Defuzz handles both built-in and custom defuzzification methods.

The built-in defuzzification methods are:

Method | Value Returned
--- | ---
centroid | Return the x-value of the centroid of the continuous area described by the x-value, y-value pairs (using a weighted average calculation). (Thanks to Luis for this improvement to the toolkit).
centroid_integral | Return the x-value of the centroid of the continuous area described by the x-value, y-value pairs (using an integral calculation). In some cases, this option will be more accurate than the "centroid" option, but it will always be less efficient. Nevertheless, either "centroid" or "centroid_integral" should work equally well in most cases.
bisector | Return the x-value of the vertical bisector of the area.
mom | Return the mean x-value of the points with maximum y-values.
som | Return the smallest (absolute) x-value of the points with maximum y-values.
lom | Return the largest (absolute) x-value of the points with maximum y-values.
wtaver | Return the weighted average of the x-values, with the y-values used as weights. (Identical to the "centroid" option above.)
wtsum | Return the weighted sum of the x-values, with the y-values used as weights.