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:

MethodValue Returned
centroidReturn 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_integralReturn 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.
bisectorReturn the x-value of the vertical bisector of the area.
momReturn the mean x-value of the points with maximum y-values.
somReturn the smallest (absolute) x-value of the points with maximum y-values.
lomReturn the largest (absolute) x-value of the points with maximum y-values.
wtaverReturn the weighted average of the x-values, with the y-values used as weights. (Identical to the "centroid" option above.)
wtsumReturn the weighted sum of the x-values, with the y-values used as weights.