Mamdani Fuzzy Model
Introduction
The Mamdani fuzzy inference system was proposed as the first attempt to control a steam engine and boiler combination by a set of linguistic control rules obtained from experienced human operators. Figure 1 is an illustration of how a tworule Mamdani fuzzy inference system derives the overall output z when subjected to two crisp inputs x and y.
If we adopt max and algebraic product as our choice for the Tnorm and Tconorm operators, respectively, and use maxproduct composition instead of the original maxmin composition, then the resulting fuzzy reasoning is shown in Figure2, where the inferred output of each rule is a fuzzy set scaled down by its firing strength via algebraic product. Although this type of fuzzy reasoning was not employed in Mamdani's original paper, it has often been used in the literature. Other variations are possible if we use different Tnorm and Tconorm operators.
In Mamdani's application [1], two fuzzy inference systems were used as two controllers to generate the heat input to the boiler and throttle opening of the engine cylinder, respectively, to regulate the steam pressure in the boiler and the speed of the engine. Since the plant takes only crisp values as inputs, we have to use a defuzzifier to convert a fuzzy set to a crisp value.
Defuzzification
Defuzzification refers to the way a crisp value is extracted from a fuzzy set as a representative value. In general, there are five methods for defuzzifying a fuzzy set A of a universe of discourse Z, as shown in Figure 3. (Here the fuzzy set A is usually represented by an aggregated output MF, such as C' in Figures 4.2 and 4.3).
A brief explanation of each defuzzification strategy are shown as follows:

Centroid of area z_{COA}:
where μ_{A}(z) is the aggregationed output MF. This is the most widely adopted defuzzification strategy, which is reminiscent of the calculation of expected values of probability distributions. 
Bisector of area z_{BOA}: z_{BOA} satisfies
where α=min{zz ∈ Z} and β=max{zz ∈ Z}. That is, the vertical line z=z_{BOA} partitions the region between z=α, z=β, y=0 and y=μ_{A}(z) into two regions with the same area. 
Mean of maximum z_{MOM}: z_{MOM} is the average of the maximizing z at which the MF reach a maximum μ*. In symbols
where Z' = {z  μ_{A}(z)=μ*}. In particular, if μ_{A}(z) has a single maximum at z=z*, then z_{MOM}=z*. Moreover, if μ_{A}(z) reaches its maximum whenever z ∈ [z_{left}, z_{right}] (This is the case in Figure 3), then zMOM = (z_{left} + z_{right})/2. The mean of maximum is the defuzzification strategy employed in Mamdani's fuzzy logic controllers.  Smallest of maximum z_{SOM}: z_{SOM} is the minimum (in terms of magnitude) of the maximizing z.
 Largest of maximum z_{LOM}: z_{LOM} is the maximum (in terms of magnitude) of the maximizing z. Because of their obvious bias, z_{SOM} and z_{LOM} are not used as often as the other three defuzzification methods.
The calculation needed to carry out any of these five defuzzification operations is timeconsuming unless special hardware support is available. Furthermore, these defuzzification operations are not easily subject to rigorous mathematical analysis, so most of the studies are based on experimental results. This leads to the propositions of other types of fuzzy inference systems that do not need defuzzification at all; two of them are introduced:
 Sugeno Fuzzy Models (Also known as TakagiSugeno or TSK Fuzzy Model);
 Tsukamoto Fuzzy Models ;
Example 1: Singleinput singleoutput Mamdani fuzzy model
An example of a singleinput singleoutput Mamdani fuzzy model with three rules can be expressed as:
Figure 3 plots the membership functions of input X and output Y, where the input and output universe are [10, 10] and [0, 10], respectively. With maxmin composition and centroid defuzzification, we can find the overall inputoutput curve, as shown in Figure 4. Note that the output variable never reaches the maximum (10) and minimum (0) of the output universe. Instead, the reachable minimum and maximum of the output variable are determined by the centroids of the leftmost and rightmost consequent MFs, respectly.
Example 2: Twoinput singleoutput Mamdani fuzzy model
An example of a twoinput singleoutput Mamdani fuzzy model with four rules can be expressed as:
Figure 6
Figure 5 plots the membership functions of input X and Y and output Z, all with the same universe [5, 5]. With maxmin composition and centroid defuzzification, we can find the overall inputoutput surface, as shown in Figure 6. For a multipleinput fuzzy model, sometimes it is helpful to have a tool for viewing the process of fuzzy inference; Figure 7 is the fuzzy inference viewer available in the Matlab Fuzzy Logic Toolbox, where you can change the input values by click and drag the input vertical lines and then see the interactive changes of qualified consequent MFs and overall output MF.
Figure 7
References & Resources
 Book  Neuro Fuzzy and soft computing
 [1] E.H. Mamdani and S. Assilian. An experiment in linguistic synthesis with a fuzzy logic controller. International Journal of ManMachine Studies, 7(1):113. 1975
Latest Post
 Dependency injection
 Directives and Pipes
 Data binding
 HTTP Get vs. Post
 Node.js is everywhere
 MongoDB root user
 Combine JavaScript and CSS
 Inline Small JavaScript and CSS
 Minify JavaScript and CSS
 Defer Parsing of JavaScript
 Prefer Async Script Loading
 Components, Bootstrap and DOM
 What is HEAD in git?
 Show the changes in Git.
 What is AngularJS 2?
 Confidence Interval for a Population Mean
 Accuracy vs. Precision
 Sampling Distribution
 Working with the Normal Distribution
 Standardized score  Z score
 Percentile
 Evaluating the Normal Distribution
 What is Nodejs? Advantages and disadvantage?
 How do I debug Nodejs applications?
 Sync directory search using fs.readdirSync