A fuzzy controller replaces sharp thresholds with degrees of membership. Each crisp input (temperature, humidity) is fuzzified against three overlapping membership functions (Cold/Warm/Hot, Low/Medium/High) — a shoulder or triangle shape returning a value μ ∈ [0,1] instead of a binary yes/no.
μA(x) ∈ [0,1]
strength = min(μtemp, μhum) (rule AND)
clipped(x) = min(strength, μout(x)) (implication)
agg(x) = max over rules of clipped(x) (aggregation)
centroid = ∫x·agg(x)dx / ∫agg(x)dx
- Fuzzification — the top two plots show where the crisp Temperature/Humidity markers sit against each membership curve, and their intersection heights.
- Inference — the 3×3 rule grid lights each cell by its firing strength = min of the two input memberships (a Mamdani AND).
- Aggregation & defuzzification — the bottom plot shows each output set clipped by its rule's strength, unioned (max) into one shape, then collapsed to a single crisp Fan-speed value by centroid (area-weighted mean) or mean-of-maximum.
- Auto-sweep — animates the temperature input so you can watch the crisp output track the rule base continuously instead of one point at a time.
This is the same fuzzification → inference → defuzzification pipeline used in real fuzzy controllers, e.g. an appliance choosing fan speed from "IF temperature is warm THEN fan speed is high"-style rules.