Reading Time: 4 minutes

Go to Fuzzy Logic Calculator

Fuzzy logic is brilliant engineering and data analysis approach proposed by Lotfi A. Zadeh. It is “exploded” now and even has it’s own IEEE Transaction. It means that this concept in controlling and data analysis can be really enhanced and it still growing and expanding. In this article only basic concept of Fuzzy logic is presented and basic examples of fuzzy logic are given. In order to use fuzzy logic we need to have at least two input magnitudes (as more as better for fuzzy logic). Let’s denote inputs with x and y. On order to apply fuzzy analysis we need to follow three basic steps:

  • Fuzzification of the inputs
  • Fuzzy-Inference
  • Defuzzification of obtaining crisp output

For fuzzification we need to have fuzzy set for each input. These set is kind of linguistic variables such as relative terms: far, close, cold, warm, hot, small, normal, high, etc. Once when fuzzy set is defined, for each of the variables there has to be calculated degree of membership for every input. Minimum degree of membership is zero, and maximum is 1 or 100%. In terms of fuzzy set, water of 20°C can be defined as 5% cold and 70% nicely warm. We can defined as perfectly 100% nicely warm and 0% cold, let’s say temperature of 25°C, and so forth. To calculate degree of membership it is easiest to use linear functions, such as presented in figure bellow.


However, calculation of the degree of membership is not limited to linear functions only. Gaussian or some arbitrary functions can be used as it is shown in figure bellow. In that sense, number of possibilities is theoretically infinite.


Degrees of membership has to be calculated for every input and every fuzzy set for that input. After that, first step (fuzzification) is done and data should be further processed in second step (fuzzy-inference).

All numerical data obtained in fuzzification process need to be mutually compared in “if-then” fashion. This process is called fuzzy-inference. Overall number of “if-then” rules is equal to product of fuzzy set numbers for each input. For example, if we have two input values, and input x has three fuzzy sets (negative, optimal and positive), and input y has five fuzzy sets (negative, negative-optimal, optimal, optimal-positive and positive), than we need to have 15 “if-then” rules, comparing negative degree of membership of x with negative degree of membership of y, negative degree of membership of x with negative-optimal degree of membership of y and so forth. So, we need to compare at least two numbers in every “if-then” rule, but there are more numbers to compare and more “if-then” rules if there is more inputs. There are several options to choose how to determine output from compared numbers in each “if-then” rule. Options are following:

  • Choose minimum: μ=min{x,y,z}
  • Choose maximum: μ=max{x,y,z}
  • Choose complement μC=1-μ

After fuzzy-inference, we obtain as many numbers to proceed as there was “if-then” rules, since every rule obtained one number from pair, or triple or from multiple numbers.

Final step is called defuzzification and it is used for obtaining crisp output from numbers obtained in step fuzzy-inference. In order to calculate crisp output we can use “center of gravity” or some other method. Together with numbers from fuzzy-inference, we need to have additional parameters called “singleton values”. Singleton values can be defined from experience. If we want to have crisp output in range from zero (minimum) to some maximal value, let’s say 1000, we can use three constant, for example 2 for low singleton constant, 550 for medium singleton constant and 920 for high singleton constant. Then we need to make schedule of singleton constants and map them on fuzzy-inference data. Crisp output then can be calculated as division of sum of mutual products of fuzzy-inference data with corresponding singleton constant and sum of corresponding singleton constants.

For example, if we have two inputs, x and y, and each of the inputs has three different fuzzy sets, let say low, optimal and high for x and negative, zero and positive for y. Now let x is 0.3 low and 0.6 optimal and 0 high. For y, let’s say that y is 0 negative, 0.5 zero and 0.75 positive. Let’s choose “minimal value” as “if-then rule”. Then fuzzy-inference step for given data is given in table bellow.


Table of singleton constant values:


So crisp output can be calculated when singleton table is mapped over fuzzy-inference data, and formula is:




Go to Fuzzy Logic Calculator

External links:

Fuzzy logic on plato.stanford.edu
Fuzzy logic on seattlerobotics.org

Leave a Reply

Your email address will not be published. Required fields are marked *