# FUZ: Fuzzy Logic Fuzzification and Defuzzification

### Fuzzy control or decisions based on empirical rules can be an interesting alternative when a mathematical model does not exist or is too complex.

• In combination with the COM function for serial communication it is easy to develop effective control systems.
• FUZ( [overlap,] FuzzySet, LinguisticVariables ) = input_value ! fuzzification
• output_value = FUZ( [overlap,] FuzzySet, LinguisticVariables) ! defuzzification
• FuzzySet is a vector of fuzzy memberships like
• REAL :: prices(3) ! define the vector prices with 3 elements
• prices = (1, 5, 20) ! give prices specific values
• LinguisticVariables is either a vector or a series of scalars with the same number of elements as FuzzySet to hold the partial membership of a specific value to FuzzySet like
• linguistic_variables = ( cheap, average, expensive )
• build a in 3 levels:
1. : obtain fuzzy set memberships of inputs by
• FUZ(set_i, vars_i) = input_i
example:
• FUZ(prices, cheap, average, expensive) = 10 ! sets cheap=0, average=2/3, expensive=1/3
• FUZ(qualities, q_vector) = this_sample ! sets the elements of q_vector
2. : make rules to deduce linguistic output memberships from linguistic input memberships like
• good_value = MIN(cheap, high_quality , pretty) ! MIN as the fuzzy operator AND
• low_value = MAX(expensive, low_qualitity) ! MAX as fuzzy operator OR
• no_value = (long_delivery + ugly)/2 ! no reason not to invent your own fuzzy operators, fuzzy is very docile!
3. : combine inference variables to a specific output by
• output = FUZ(set_o, vars_o)
example:
• rating = FUZ(scale, no_value, low_value, good_value) ! calculated as memberships "center of gravity" in scale
• overlap is an optional number of neighbors in FuzzySet (default = 1):
• overlap = 1 (default): values are distributed to 1 left and 1 right member
• FUZ(n, FuzzySet, LingVars) extends this to n neighbors. This can help to smooth the results.
• linguistic variables need not be normalized
• best results seem to be obtained for odd dimensions of the fuzzy sets
• FuzzySets are handled internally as triangular distributions in HicEst
• Demonstration of a simple fuzzy braking algorithm
1. fuzzification (distribute input to linguistic variables):
• REAL :: REAL :: speed_set(3), distance_set(3), brake_set(3)
• speed_set = ( 0, 50, 100) ! km/h
• FUZ( speed_set, slow, town, fast) = speed
• ! eg speed=40: 0.2, 0.8, 0
• distance_set = ( 5, 30, 100) ! m
• FUZ( distance_set, short, medium, long) = distance
• ! eg distance=65; 0, 0.5, 0.5
2. inferences :
• soft = MAX(slow, long) ! eg 0.5
• moderate = MAX(town, medium) ! eg 0.8
• hard = MAX(fast, short) ! eg 0
3. defuzzification :
• brake_set = ( 0, 0.3, 1)
• brake = FUZ(brake_set, soft, moderate, hard)
4. graphical test : • note the nonlinearities even for this extremely simple model
• results become smoother with overlap > 1 and with more inferences

Support HicEst   ⇾ Impressum