Skip to main content

Fuzzy logic and fuzzy inference

Short answer

Fuzzy logic handles partial truth with membership functions. Mamdani inference fuzzifies crisp inputs, evaluates rules by min clipping, aggregates by max, and defuzzifies via centroid. Example: temperature 28°C, humidity 60% gives fan speed ≈ 59.6%.

What is Fuzzy Logic? Explain the Fuzzy Inference (Mamdani Fuzzy Inference Method) with suitable example.

Fuzzy logic

Fuzzy logic is a form of many-valued logic introduced by Lotfi Zadeh (1965) in which a statement can be partially true, with a degree of truth between 0 and 1, instead of only true (1) or false (0). It handles vagueness and uncertainty in human language such as "warm", "tall" or "fast".

  • A fuzzy set A is defined by a membership function μA(x) ∈ [0, 1].
  • Operations: AND (intersection) μ = min(μA, μB); OR (union) μ = max(μA, μB); NOT μ = 1 − μA.
  • Linguistic variables (e.g. temperature) take values such as Cold, Warm, Hot.

Mamdani fuzzy inference

Mamdani's method (1975) uses IF-THEN rules whose inputs and outputs are fuzzy sets. Four steps:

  1. Fuzzification: convert crisp inputs to membership degrees in the input fuzzy sets.
  2. Rule evaluation: compute the firing strength of each rule (AND = min, OR = max); clip (min) the output set at this strength.
  3. Aggregation: combine all clipped output sets into one fuzzy set using max (union).
  4. Defuzzification: convert the aggregated set into one crisp value, usually by the centroid method: x* = Σ x·μ(x) / Σ μ(x).
Crisp   -> Fuzzification -> Rule evaluation -> Aggregation
input                          (rule base)         |
                                                   v
Crisp output <------------ Defuzzification <-------+

Example: fan speed controller

Inputs: temperature = 28 °C, humidity = 60 %. Output: fan speed (0-100 %).

Rules:

  • R1: IF temperature is Hot AND humidity is High THEN speed is Fast.
  • R2: IF temperature is Warm AND humidity is Medium THEN speed is Medium.

Membership functions (triangular, given as (left, peak, right)): Warm (15, 25, 35), Hot (25, 40, 55); Medium humidity (30, 50, 70), High (50, 80, 110); speed Medium (25, 50, 75), Fast (50, 100, 150).

Step 1: Fuzzification

  • μWarm(28) = (35 − 28)/10 = 0.7; μHot(28) = (28 − 25)/15 = 0.2
  • μMedium(60) = (70 − 60)/20 = 0.5; μHigh(60) = (60 − 50)/30 = 0.33

Step 2: Rule firing strength

  • R1 = min(0.2, 0.33) = 0.2 → clip "Fast" at 0.2
  • R2 = min(0.7, 0.5) = 0.5 → clip "Medium" at 0.5

Step 3: Aggregation (max of the clipped sets), sampled every 10 %:

Speed x30405060708090100
Medium clipped0.20.50.50.50.2000
Fast clipped0000.20.20.20.20.2
Aggregate μ0.20.50.50.50.20.20.20.2

Step 4: Defuzzification (centroid)

Σ x·μ = 30(0.2) + 40(0.5) + 50(0.5) + 60(0.5) + 70(0.2) + 80(0.2) + 90(0.2) + 100(0.2) = 149

Σ μ = 2.5

x* = 149 / 2.5 ≈ 59.6 %

Answer: the fan speed is set to about 60 %.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Artificial Intelligence chapter 4 questions →