Control via Fuzzy Logic

The previous chapter, The Basics of Control Theory, designed controllers by exact mathematical means — for instance choosing the feedback gains of a linear feedback control so the controlled system ends up with the eigenvalues, and hence the stability and response, we want. That approach is precise, but it is not always intuitive: it tells you which matrix to build, not in plain words why the controller acts the way it does, and it leans on having a mathematical model accurate enough to compute with.

Fuzzy logic is a different apparatus for the same job. Instead of sharp numerical thresholds it reasons with graded, human-readable notions like cold, lukewarm, and hot, and with intuitive IF–THEN rules an expert could state in words. Before we apply it to a control problem, we build up its vocabulary: fuzzy sets, the operations on them, and linguistic variables.

Crisp sets and fuzzy sets

Ordinary set membership is all-or-nothing: a given element is either in a set or it is not. Fuzzy logic relaxes exactly this, so the first thing it does is rename the ordinary kind of set to keep the two apart.

A crisp set XX is a set in the ordinary sense — finite or infinite — in which membership is all-or-nothing: every element either belongs to XX or does not.

A concrete element of a crisp set, such as a definite measured number, is called a crisp value (also a sharp value) — a plain, exact number with no ambiguity about it.

A fuzzy set keeps the same underlying collection of candidate elements but softens what “belongs” means.

A fuzzy set A~\tilde A over a crisp set XX generalizes the all-or-nothing notion of membership: rather than being simply in or out, each element xXx \in X belongs to A~\tilde A to a degree of membership between 00 and 11, assigned by a membership function

μ(,X,A~):X[0,1].\mu(\cdot, X, \tilde A) : X \to [0,1].

The value μ(x,X,A~)\mu(x, X, \tilde A) states, for every element xXx \in X, the degree to which xx belongs to the fuzzy set A~\tilde A: 00 means “not a member”, 11 means “fully a member”, and an intermediate value like 0.90.9 means “largely a member” while 0.10.1 means “barely a member”. One can write the fuzzy set out as its set of element–degree pairs,

A~={(x,μ(x,X,A~))xX}.\tilde A = \{\, (x, \mu(x, X, \tilde A)) \mid x \in X \,\}.

The three-argument notation μ(x,X,A~)\mu(x, X, \tilde A) keeps explicit which element (xx), which underlying crisp set (XX), and which fuzzy set (A~\tilde A) we are asking about — useful once several fuzzy sets live over the same XX.

A degree of membership is not a probability. It looks superficially like one — a number in [0,1][0,1] — but it obeys no normalization rule. If A~\tilde A and B~\tilde B are two fuzzy sets over the same XX, the same element can belong substantially to both, so

μ(x,X,A~)+μ(x,X,B~)>1\mu(x, X, \tilde A) + \mu(x, X, \tilde B) > 1

is perfectly possible. The degree measures how well xx fits the description A~\tilde A, not how likely xx is to be something.

Two special cases tie the new notion back to the familiar one. Viewing the whole crisp set XX as a fuzzy set over itself gives full membership everywhere, μ(x,X,X)=1\mu(x, X, X) = 1 for all xXx \in X; and any ordinary crisp set AA is just the special fuzzy set whose membership is 11 on its elements, μ(x,X,A)=1\mu(x, X, A) = 1 for all xAx \in A (and 00 off it). So crisp sets are the corner case of fuzzy sets where the only degrees used are 00 and 11.

Two derived notions pick out parts of a fuzzy set by their degree of membership.

The support of a fuzzy set A~\tilde A is the crisp set of all elements with nonzero membership,

supp(A~)={xXμ(x,X,A~)>0}.\mathrm{supp}(\tilde A) = \{\, x \in X \mid \mu(x, X, \tilde A) > 0 \,\}.

For a level α[0,1]\alpha \in [0,1], the α\alpha-level-set (also called the α\alpha-cut) of A~\tilde A keeps exactly those element–degree pairs whose membership reaches at least α\alpha,

A~α={(x,μ(x,X,A~))xX and μ(x,X,A~)α}.\tilde A_\alpha = \{\, (x, \mu(x, X, \tilde A)) \mid x \in X \text{ and } \mu(x, X, \tilde A) \ge \alpha \,\}.

A closely related operation does not throw the low-membership elements away but instead caps every degree at the level α\alpha.

The cut fuzzy set A~α\tilde A \uparrow \alpha bounds the degrees of membership from above at the level α\alpha: it keeps a degree unchanged where it is already at most α\alpha, and clips it down to α\alpha wherever it would exceed it,

μ(x,X,A~α)={μ(x,X,A~),if μ(x,X,A~)α,α,else.\mu(x, X, \tilde A \uparrow \alpha) = \begin{cases} \mu(x, X, \tilde A), & \text{if } \mu(x, X, \tilde A) \le \alpha, \\ \alpha, & \text{else.} \end{cases}

The distinction between the two is worth fixing: the α\alpha-cut discards elements below the level α\alpha but leaves the surviving degrees alone, whereas the cut fuzzy set keeps every element but flattens the top of the membership function at height α\alpha. The cut fuzzy set is the one that does the work later, when a partly-satisfied rule is only allowed to fire partly.

Shapes of the membership function

Once the framework is in place, the essential modeling task is concrete: defining the shape and values of the membership function for each fuzzy set. This is where the modeler’s knowledge enters. The plain 00-to-11 leap recovers ordinary crisp sets; everything in between is a design choice, and many shapes are imaginable — piecewise linear, piecewise polynomials of higher degree, and so on. Available fuzzy-logic systems offer a handful of simple, ready-made options.

A useful way to read any of these shapes: plotted with the element xx on the horizontal axis and the degree μ\mu on the vertical axis, a vertical side is an abrupt jump between full and zero membership — a crisp boundary — while a sloped side is a transition region of graded, partial membership, where the answer to “does xx belong?” is “somewhat”. The shapes below differ mainly in how wide and how smooth they make those transition regions.

  • rectangle — both sides vertical, no transition region at all. This is just a crisp set drawn as a membership function: full membership inside the interval, none outside.
  • triangle — often isosceles, but not necessarily. Membership rises linearly to a single peak at 11 and falls back, so the two sloped sides are pure transition regions meeting at one fully-typical value.
  • trapezoid — often symmetric, but not necessarily. Like a triangle but with a flat top: a band of values at full membership 11, flanked by two linear transition regions.

Smoother and one-sided shapes round out the catalog:

  • S-form and Z-form — typically used for one-sided delimited terms, where membership saturates at one end. An S-form rises from 00 to 11 as xx increases (e.g. “large”, which only gets more true the bigger xx is); a Z-form is its mirror, falling from 11 to 00.
  • bell curve — often used for both-sided delimited terms: membership is high over a central band and tapers smoothly to 00 on either side, like a rounded trapezoid.
  • Also common are polygonal lines and a sinus half-period for the rising and falling flanks.

Operations on fuzzy sets

To reason with fuzzy sets we need counterparts to the standard set operations (and, equivalently, the logical connectives) — an intersection, a union, and a complement. There is wide scope in how to realize them concretely, adjustable to the application, but one restriction keeps the whole framework honest: the usual rules of logic must still hold in the crisp limit case, where every membership function is identically 11 or identically 00 (μ1\mu \equiv 1, μ0\mu \equiv 0). Fuzzy logic is meant to extend crisp set theory, not to replace it with something unrelated, so whatever definitions we pick must reduce to ordinary intersection, union, and complement when the degrees collapse back to 00 and 11.

The standard choices are the simplest ones that pass that test.

The intersection C~=A~B~\tilde C = \tilde A \cap \tilde B takes the pointwise minimum of the two membership functions,

μ(x,X,C~)=min{μ(x,X,A~),μ(x,X,B~)}.\mu(x, X, \tilde C) = \min\{\, \mu(x, X, \tilde A), \mu(x, X, \tilde B) \,\}.

The union C~=A~B~\tilde C = \tilde A \cup \tilde B takes the pointwise maximum of the two membership functions,

μ(x,X,C~)=max{μ(x,X,A~),μ(x,X,B~)}.\mu(x, X, \tilde C) = \max\{\, \mu(x, X, \tilde A), \mu(x, X, \tilde B) \,\}.

The complement C~=A~\tilde C = \overline{\tilde A} flips each degree of membership about 12\tfrac12,

μ(x,X,C~)=1μ(x,X,A~).\mu(x, X, \tilde C) = 1 - \mu(x, X, \tilde A).
Why these reduce to ordinary set operations

Restrict the degrees to the crisp values 00 and 11. For the intersection, min\min returns 11 only when both inputs are 11 — exactly the AND truth table — and 00 otherwise, so A~B~\tilde A \cap \tilde B becomes the ordinary intersection. For the union, max\max returns 11 as soon as either input is 11 — the OR truth table — recovering the ordinary union. And 1μ1 - \mu swaps 00 and 11, the NOT operation, so A~\overline{\tilde A} becomes the ordinary complement. The definitions therefore satisfy the crisp-limit restriction.

Linguistic variables

Working directly with membership functions is precise but unwieldy. To give an expert something intuitive to reason with, fuzzy control groups the fuzzy sets over one quantity under everyday words — cold, warm, hot — and treats those words as the values a variable can take.

A linguistic variable is characterized by its name vv and its possible values, the linguistic terms. It carries:

  • an associated crisp set XX — the ordinary scale the quantity is measured on;
  • a term set T(v)T(v), the set of all linguistic terms the variable may take;
  • one fuzzy set over XX for each term — so each word like “cold” is a fuzzy set, whose membership function says to what degree any given measured value counts as that word.

For example, a linguistic variable named temperature has the temperature scale as its crisp set and a term set such as freezing cold – cold – neutral – lukewarm – warm – hot; a linguistic variable named color has a frequency range (roughly 400800nm400\text{–}800\,\mathrm{nm}) as its crisp set and terms like green – yellowish-green – yellow-green – greenish-yellow – yellow.

Two design decisions come up immediately, and both are matters of modeling judgment rather than fixed rules. How many terms? Enough to express the distinctions the model needs, but not so many that neighboring terms can no longer be told apart. What shape for each term? Any of the membership-function shapes above, chosen to fit how the quantity behaves.

For the linguistic variable temperature, the crisp set is the temperature scale (real numbers, or a subinterval of them), the terms are freezing cold – cold – neutral – lukewarm – warm – hot, and each term gets its own membership function over that scale. The terms overlap: around a borderline reading, a temperature can count partly as cold and partly as neutral at the same time. The two end terms are one-sided — freezing cold stays at full membership for everything cold enough (open to the left) and hot likewise for everything hot enough (open to the right).

Two guidelines make such a layout usable. First, the terms should cover the whole range of values to be described, with no gaps — a gap would be a span of temperatures the system has no word for, and it could say nothing there. Second, the terms should still be distinguishable — piling many heavily-overlapping terms on top of each other leaves no reading that picks out one term clearly. A good layout is well spread and gapless. Note that, since the degrees come from independent fuzzy sets, the sum of all degrees of membership at a given value need not be 11 — this is the non-probabilistic nature of fuzzy membership again, seen across the terms of one variable.

Fuzzy control systems

With this vocabulary in hand — fuzzy sets, their operations, and linguistic variables — fuzzy logic can be turned into a controller. A fuzzy control system is today very common, especially in consumer products like washing machines, dishwashers, and cameras, where the control task does not demand high precision. Its appeal comes from three places:

  • No mathematical model needed. For many processes there is no model available, or the available one is far too complex to be useful. The previous chapter, The Basics of Control Theory, considered only the comparatively simple case of a system of homogeneous linear ODEs; the real world is usually much more complicated, and handling it by exact mathematics demands considerable effort. A fuzzy controller sidesteps the need for such a model.
  • Modest mathematics. Building one is possible with little more than “school mathematics” — no eigenvalue analysis, no matrix algebra.
  • Intuitive rules. The behavior is specified by linguistic, colloquial IF–THEN rules of the kind a human expert can simply state in words, which makes the controller easy to design and easy to read.

Inside the controller everything is evaluated fuzzily, but the two ends of the chain are firmly crisp: at the very beginning a sensor delivers a crisp value (a measured temperature, say), the fuzzy apparatus takes the detour through its fuzzy world, and at the very end the result is translated back into a crisp value — the setting actually applied to the actuator.

A fuzzy control system is a controller that maps a crisp measured value to a crisp control value by reasoning, in between, with fuzzy sets and intuitive linguistic IF–THEN rules. The input and output are crisp; only the processing is fuzzy.

Every fuzzy controller is built from the same four steps, run in order:

  1. Fuzzification — translate the crisp measured quantities into the fuzzy world: define the linguistic variables, their terms, and the membership functions, and read off the degree of membership of each measured value.
  2. Rule base — the IF–THEN rules relating the variables, drawn from expert knowledge.
  3. Inference — apply suitable inference operators to carry the fuzziness of the measured variables over to the control variables.
  4. Defuzzification — collapse the resulting fuzzy control values back into crisp control values.

We follow these four steps through one running example: controlling a cooling valve. The state variable is the temperature TT, and the control variable is the position KK (taking concrete values kk) of the cooling valve — how far it is opened. Throughout, a capital letter (TT, KK) names the linguistic variable together with the crisp scale it lives on, while the matching lowercase letter (tt, kk) denotes a concrete crisp value on that scale.

Step 1: Fuzzification

The general principle of fuzzification is short:

  • the measured values originate from crisp sets — each measured quantity is a linguistic variable with its own scale;
  • for every linguistic variable there are several fuzzy sets, its linguistic terms, laid out to match human perception;
  • for every measured value we determine its degree of membership in all of those terms.

So a single sharp reading does not pick out one term — it produces a whole profile of degrees. Measure 1717^\circ, for instance, and we ask to what degree that reading counts as low, as medium, and as high, getting a number in [0,1][0,1] for each.

Fuzzification is the first step of a fuzzy control system: it takes a crisp measured value tt and, for each fuzzy set (linguistic term) of the relevant linguistic variable, computes the degree of membership μ(t,X,A~)\mu(t, X, \tilde A) of that value. One crisp number is thereby replaced by a profile of membership degrees, one per term.

In the cooling-valve example a temperature value tt has been measured, and two linguistic variables (each with its own fuzzy sets) are in play: the temperature TT, with terms low, medium, high; and the valve position KK, with terms almost closed, ajar, almost open over the position scale kk. The temperature is what we measure; the valve position is what we will ultimately control.

Fuzzifying the reading tt against the temperature terms gives its degrees of membership, e.g.

μn=μ(t,T,low)0.85,μm=μ(t,T,medium)0.3,μ(t,T,high)=0.\mu_n = \mu(t, T, \text{low}) \approx 0.85, \qquad \mu_m = \mu(t, T, \text{medium}) \approx 0.3, \qquad \mu(t, T, \text{high}) = 0.

The reading is largely low, somewhat medium, and not at all high — the overlapping terms let it count as more than one thing at once.

Step 2: The rule base

The second step encodes the controller’s behavior as rules, and like the membership-function shapes it draws on domain expertise. Its pieces are:

  • an elementary condition of the form X=A~X = \tilde A — a linguistic variable XX (on its crisp set) set equal to one of its fuzzy sets (terms) A~\tilde A. Read it as “the variable XX currently takes the term A~\tilde A”, e.g. "T=lowT = \text{low}" means “the temperature is low”;
  • a logical connection of elementary conditions through the usual operators AND, OR, NOT;
  • a triggered action of the form Y=B~Y = \tilde B — a linguistic variable YY set to a term B~\tilde B.

Putting these together gives rules of the form

IF X1=A~1,j AND X2=A~2,j THEN Y=B~j(rule j),\text{IF } X_1 = \tilde A_{1,j} \text{ AND } X_2 = \tilde A_{2,j} \text{ THEN } Y = \tilde B_j \qquad (\text{rule } j),

with their respective linguistic variables and terms. The double subscript on A~1,j\tilde A_{1,j} keeps the bookkeeping straight: the first index says which input variable the condition is about, the second says which rule it belongs to.

Two things about the notation X=A~X = \tilde A are worth pinning down, because both stretch the symbols a little.

First, XX here names a linguistic variable, even though the very same letter stood for a plain crisp set back when we defined fuzzy sets and membership functions μ(,X,A~)\mu(\cdot, X, \tilde A). There is no real conflict: a linguistic variable is identified with the crisp scale it is measured on, so XX does double duty — it is both the variable and its underlying crisp set, and the elementary condition simply picks out one of the fuzzy sets (terms) A~\tilde A living over that set.

Second, the "==" is not literal equality — a variable is not the same kind of object as a fuzzy set, so it cannot actually equal one. It is shorthand for “the variable XX is described by the term A~\tilde A”. And even that is rarely all-or-nothing: at a concrete measured value tt, the reading does not simply satisfy or fail the condition "T=lowT = \text{low}", it satisfies it to a degree — namely its degree of membership

μ(t,X,A~)[0,1].\mu(t, X, \tilde A) \in [0,1].

So "T=lowT = \text{low}" is really asking to what degree is the measured temperature low?, and a borderline reading can be partly low and partly medium at once. Collapsing each such question down to a single number for the whole IF-part is exactly the job of the inference step that follows.

The rule base of a fuzzy control system is its collection of IF–THEN rules, drawn from expert knowledge. Each rule jj connects elementary conditions Xi=A~i,jX_i = \tilde A_{i,j} (a variable equal to a term) with the operators AND (logical conjunction), OR (logical disjunction), NOT (logical negation) in its IF-part, and names a triggered action Y=B~jY = \tilde B_j in its THEN-part.

For the cooling valve a small rule base suffices to illustrate the mechanics:

  • rule 1: IF T=lowT = \text{low} THEN K=ajarK = \text{ajar} (half-open);
  • rule 2: IF T=mediumT = \text{medium} THEN K=almost openK = \text{almost open}.

This is a deliberately reduced rule base, kept to the two rules the measured value will actually trigger — it says nothing about what to do when T=highT = \text{high}. A complete controller would add a rule for the high term too, so that the rules cover the whole range of temperatures with no gaps, exactly the design guideline already noted for the terms of a linguistic variable. Each rule here also happens to use a single elementary condition, so the AND/OR/NOT machinery only comes into play once rules have several conditions.

Step 3: Inference

Inference is where the fuzziness of the measured value is carried across to the control variable — in this example the valve position KK, the quantity the controller will ultimately set. At the measured value we first calculate the degree of membership μ(x,X,A~)\mu(x, X, \tilde A) for each elementary condition (each X=A~X = \tilde A clause of an IF-part, e.g. T=lowT = \text{low}), and then combine those degrees according to the rule’s connectives, the logical operators AND, OR, and NOT that join the conditions:

  • AND as the intersection of fuzzy sets — the minimum of the membership degrees;
  • OR as the union of fuzzy sets — the maximum of the membership degrees;
  • NOT as the complement — one minus the membership degree.

A single elementary condition just reads off the one degree of the term it names: T=mediumT = \text{medium} contributes the number μ(t,T,medium)\mu(t, T, \text{medium}) and nothing else, and how strongly the reading belongs to the other terms (low or high) plays no part in it. The connectives (AND, OR, NOT) then fold several such degrees into one, using the minimum, maximum, and complement rules just listed. The net effect is that the entire IF-part (the left side of the rule) collapses to a single fuzzy membership degree μj\mu_j. Informally the rule has become “IF μj\mu_j THEN …”, and that one number measures how strongly the rule’s premise is met.

The obvious inference strategy then propagates that strength to the conclusion: the value μj\mu_j of the IF-part limits the membership degree of the fuzzy set B~j\tilde B_j in the THEN-part. The reasoning is that an only partly fulfilled premise should imply an only partly executed conclusion. Concretely, for each rule jj we form the cut fuzzy set B~jμj\tilde B_j \uparrow \mu_j — the action’s membership function, capped at the height μj\mu_j.

Inference evaluates each rule of the rule base at the measured value. The IF-part is reduced to a single degree μj\mu_j by combining the membership degrees of its elementary conditions with the connectives — AND as minimum, OR as maximum, NOT as 1μ1 - \mu (complement). This μj\mu_j then caps the THEN-part fuzzy set B~j\tilde B_j from above, yielding the cut fuzzy set B~jμj\tilde B_j \uparrow \mu_j for rule jj.

Back to the example. Each of the two rules has a single condition, so its IF-part degree is read straight off the fuzzification:

  • rule 1 yields μ1=μ(t,T,low)\mu_1 = \mu(t, T, \text{low}) — about 0.850.85 at the measured tt — and caps its action accordingly: ajarμ1\text{ajar} \uparrow \mu_1;
  • rule 2 yields μ2=μ(t,T,medium)\mu_2 = \mu(t, T, \text{medium}) and caps its action: almost openμ2\text{almost open} \uparrow \mu_2.

Because μ1\mu_1 is large the ajar term is barely cut, while the smaller μ2\mu_2 cuts the almost open term down hard. What remains is, for each rule, a flat-topped fuzzy set over the valve scale kk. Turning these into a single crisp valve position is the job of the fourth and last step.

Step 4: Defuzzification

The final step turns the fuzzy outcome back into a crisp setting. By the time inference is done, every rule that fired has handed back a clipped term over the valve’s opening scale: in our example rule 1 returned ajar (but only up to the height μ1\mu_1) and rule 2 returned almost open (up to the height μ2\mu_2). It helps to picture these on one axis — the horizontal axis is the valve opening (a position on it is the value kk, running from fully shut on the left to wide open on the right), and the height above each opening is the degree to which that opening is currently endorsed. Defuzzification is the job of boiling all of these partial, overlapping verdicts down to a single number: the one opening we will actually set the valve to.

The first thing to settle is what to do when several rules reach for the same term. Suppose three rules had all concluded almost open, each with its own strength — one at 0.30.3, one at 0.50.5, one at 0.70.7. We do not add them up or average them; we keep the strongest, taking at every opening the maximum of their degrees. This is the fuzzy union, and the reasoning is plain: a term is called for as strongly as the most confident rule that calls for it, so almost open ends up endorsed at 0.70.7 and the weaker duplicates add nothing. It is the same pointwise maximum that stood for OR inside a rule’s premise, now merging rules that agree on a conclusion rather than combining conditions within one premise. And notice what it runs over: all the almost open verdicts are folded together, and separately all the ajar verdicts are folded together — the union is not trying to blend ajar into almost open.

After that merging, each concluded term is left with a single clipped shape — one for ajar, one for almost open. These sit in different stretches of the opening axis (ajar around a half-open position, almost open nearer wide open), so putting them together is mostly just laying both shapes on the same axis at once; only where two happen to overlap does the same maximum keep the higher one. The combined picture that results is the accumulation: one fuzzy shape over the whole opening range that carries every rule’s conclusion together.

Reconciling those different terms into a single opening is then a separate step, and it is the part that actually produces the crisp number. Rather than merging ajar and almost open into each other, it picks the one opening that best represents the whole combined shape. In the running example there is just one ajar rule and one almost open rule, so the union has no duplicates to merge — it simply places ajarμ1\text{ajar} \uparrow \mu_1 and almost openμ2\text{almost open} \uparrow \mu_2 side by side on the opening axis — and all the real work falls to this final step. Whichever way it is taken, the answer is a position on the opening axis, and everything being averaged along the way is likewise a position on that axis, never a degree of membership. In particular, the “maximum” and “minimum” in the first two methods below are the largest and smallest opening in a support — the right and left ends of the stretch where the shape has any height at all — and not the peak and floor of its height. There are several ways to take it:

  • the mean of the maximum and minimum of the support of the fuzzy union — find where the accumulated shape starts and where it stops, and take the midpoint of those two openings. If it runs from 20%20\% to 90%90\%, the crisp answer is 55%55\%. Only the outer boundaries count: how many terms fired, where they sit inside that stretch, and how strongly each one fired all drop out;
  • the mean of the maximum and minimum of the supports of the individual cut fuzzy sets — the same endpoint-midpoint, but computed per term first and only then averaged. If ajar’s support runs from 20%20\% to 60%60\% it contributes the representative opening 40%40\%, and if almost open’s runs from 70%70\% to 90%90\% it contributes 80%80\%; the mean of those two representatives is 60%60\%. Because every active term hands in one position of its own, this method does register how many terms fired and where each of them lies, which the outer envelope of the first method cannot see;
  • the centroid of the accumulated area — its balance point, which leans toward whichever term fired more strongly and so contributes the most area;
  • the weighted centroid, for weighted rules — the same balance point, but with each rule’s contribution additionally scaled by an importance weight.

Defuzzification is the last step of a fuzzy control system. For each control variable it takes the cut fuzzy sets that inference produced for that variable and accumulates them into one combined fuzzy set by fuzzy union. From these it then determines a single crisp control value — the number the controller actually applies — using the centroid of the accumulated area, a mean over its support, a rule working from the individual cut sets, or a similar collapse.

The most common collapse is the centroid. Writing xx for a value from the output range (the prospective control value), μ(x)\mu(x) for the membership function of the fuzzy union, gjg_j for the weight of rule jj, μj\mu_j for the result of the IF-part of rule jj, and F(A~)F(\tilde A) for the area under the membership function of fuzzy set A~\tilde A, the xx-coordinate xSx_S of the centroid is

xS=xμ(x)dxμ(x)dx.x_S = \frac{\int x\,\mu(x)\,dx}{\int \mu(x)\,dx}.

This is just the center of gravity (balance point) of the area under the accumulated membership function, projected onto the output axis. When the rules carry different weights, one instead takes the weighted average of the individual centroids,

xS=jxS,jωjjωj,ωj=F(B~jμj)μjgj,x_S = \frac{\sum_j x_{S,j}\,\omega_j}{\sum_j \omega_j}, \qquad \omega_j = F(\tilde B_j \uparrow \mu_j)\cdot \mu_j \cdot g_j,

where xS,jx_{S,j} is the centroid of rule jj‘s own cut fuzzy set and its weight ωj\omega_j folds together the cut set’s area F(B~jμj)F(\tilde B_j \uparrow \mu_j), the rule’s firing degree μj\mu_j, and the design weight gjg_j.

For the cooling valve we now have two cut fuzzy sets over the valve scale: ajarμ1\text{ajar} \uparrow \mu_1 (barely cut, since μ1\mu_1 is large) and almost openμ2\text{almost open} \uparrow \mu_2 (cut hard, since μ2\mu_2 is small). Accumulating them by fuzzy union and taking the centroid of the combined area gives a point S=(kS,μS)S = (k_S, \mu_S); its kk-coordinate kSk_S is the crisp answer, and the valve is adjusted to that position. The simplest alternative — the mean of the maximum and minimum of the support — would instead just average the outer boundaries of the accumulated region.

There are also adaptive fuzzy control systems, which do not keep the rule weights and membership functions fixed but adapt them over time as the system runs — tuning the fuzzy world itself to the process it controls.

Example: the inverted pendulum

A classic test problem for any control method is the inverted pendulum (also called a balanced pole): a rigid pole stands on a cart, hinged at its base so that it can only tip along the single direction the cart is free to move. The cart, of mass mWm_W, rolls left and right on a track, and we may push it with a horizontal force uu in either direction. Left to itself the pole topples; the control task is to drive the cart back and forth so that the pole stays balanced upright.

The state of the system is captured by a few quantities: the angle φ\varphi of the pole away from vertical, the rate φ˙\dot\varphi at which that angle is changing, the cart’s horizontal displacement ss (written s(t)s(t) as it varies in time), and the cart’s velocity s˙\dot s.

Classical modeling attacks this by writing the mechanics down directly. Balancing the horizontal and vertical forces on the pole’s center of mass, accounting for its rotational motion, and balancing the horizontal motion of the cart give four equations, which together form a system of four linear ordinary differential equations in the unknowns φ\varphi, φ˙\dot\varphi, ss, and s˙\dot s.

A fuzzy controller for the pendulum

Designing a controller for that model — even a linear feedback control — is relatively involved. Fuzzy control offers an alternative that sidesteps the model altogether: describe the situation in plain words and write down a handful of intuitive IF–THEN rules. The controller works with three linguistic variables:

  • the angle φ\varphi, with terms negative, zero, positive;
  • the angular velocity φ˙\dot\varphi (the rate of change of the angle — how fast, and in which direction, the lean is shifting), with terms negative, zero, positive;
  • the actuating force uu (the manipulated variable — the horizontal push applied to the cart), with terms large negative, negative, zero, positive, large positive.

To read the terms we fix a sign convention. We take the angle φ\varphi positive for a lean to the right (so that it grows rightward like the track’s own left-to-right axis), making a negative φ\varphi a lean to the left and φ=0\varphi = 0 the upright position. The force uu is then taken positive in the opposite direction — a push to the left — and with that choice the table below comes out so that the controller always drives the cart toward the side the pole leans (the note below sorts out what here is a free convention and what is actually fixed). The angular velocity follows from the angle: φ˙\dot\varphi positive means φ\varphi is increasing, i.e. the pole is tipping further toward the right.

The rules pair the angle with the angular velocity using a simple AND, nine in all — one for each combination of a φ\varphi term with a φ˙\dot\varphi term. A representative one is

IF φ=negative   AND   φ˙=positive   THEN u=positive.\text{IF } \varphi = \text{negative} \;\text{ AND }\; \dot\varphi = \text{positive} \;\text{ THEN } u = \text{positive}.

Behind all nine sits a single intuition: push the cart toward the side the pole is falling, sliding the support back under the toppling mass, and push harder the faster it is going over. A pole leaning left and still falling left calls for the strongest push left (large positive); one that is upright and steady calls for nothing at all (zero); and a lean that is already correcting itself needs only a gentle nudge. The example rule above is one such gentle case: the pole leans left (φ\varphi negative) but its angle is already increasing back toward vertical (φ˙\dot\varphi positive), so a moderate push toward that side (positive, a leftward push) suffices.

All nine rules are collected in a single table — the columns are the angle φ\varphi, the rows the angular velocity φ˙\dot\varphi, and each entry is the actuating force uu the rule prescribes:

φ˙  \  φ\dot\varphi \;\backslash\; \varphinegativezeropositive
negativelarge positivepositivenegative / zero
zeropositivezeronegative
positivepositive / zeronegativelarge negative

The two far corners are the clearest: a pole leaning left and falling further left (both φ\varphi and φ˙\dot\varphi negative) gets the strongest push left, large positive; a pole leaning right and falling further right (both positive) gets the strongest push right, large negative. The center cell, upright and not moving, prescribes zero, and everything in between grades smoothly between these extremes.

Sign conventions: what’s free and what’s fixed

None of the left/right choices made above are dictated by the problem; they are conventions, and the text simply had to settle on some. The angle φ\varphi is counted positive for a lean to the right — a clockwise tilt away from upright, in step with the rightward direction of the Cartesian xx-axis, which is the convenient choice for a cart on a left-to-right track — but the unit-circle convention, with positive φ\varphi running counterclockwise (so a lean to the left is positive), would serve just as well. The force uu is just as free: its positive direction could point either way.

The one thing this example does fix is the relationship between the two. Positive uu is set opposite to positive φ\varphi, so the two conventions are not independent: once you choose which way the angle counts as positive, the force’s positive direction is settled as the other way, and choosing the angle the other way flips uu with it. That tie is all that is pinned down — the absolute “left” and “right” are not.

And even the tie is just bookkeeping in service of the single physical fact underneath: the controller pushes the cart toward whichever side the pole leans. With the rule table written as it is here, opposing the two positives is what makes its abstract terms read out as a push toward the lean; lay the table out the other way around and the two positives would line up instead, describing the very same controller. Nothing here is written in stone — so whenever a particular problem states or draws its own positive directions, adopt those and adapt every sign to match. And if a problem gives you none, pick them yourself — fix a positive direction for the angle and one for the force at the outset, then hold to that choice consistently throughout.

Summary

Pulling the pieces together, a fuzzy control system runs each cycle as a fixed process chain that carries a crisp measurement into the fuzzy world, reasons there, and emerges with a crisp setting:

  • read the crisp measured value for each input variable;
  • fuzzification — set up the fuzzy world: the linguistic variables with the fuzzy sets of their terms, and the degree to which each measured value belongs to each term;
  • rule base — the IF–THEN implications that hold in that fuzzy world, drawn from expert knowledge;
  • inference — for each rule, reduce its IF-part to a single degree of membership, then use that degree to cut the fuzzy set of its THEN-part down to a cut fuzzy set;
  • defuzzification — for each control variable, take the fuzzy union of those cut fuzzy sets to recover one fuzzy set over the variable, and find the center of gravity of that accumulated area to read off a single crisp control value;
  • set each control variable to its crisp control value.