Fuzzy Logic
Introduction To Fuzzy Logic
Fuzzy Membership Functions
A Simple Fuzzy Control System


Why Fuzzy Logic?

        Fuzzy logic is an interesting subject to contemplate.


Why Fuzzy Logic? - What the Experts Have to Say!

        Fuzzy theory is wrong, wrong, and pernicious.  What we need is more logical thinking, not less.  The danger of fuzzy logic is that it will encourage the sort of imprecise thinking that has brought us so much trouble.  Fuzzy logic is the cocaine of science.

Professor William Kahan
University of California at Berkeley
        "Fuzzification" is a kind of scientific permissiveness.  It tends to result in socially appealing slogans unaccompanied by the discipline of hard scientific work and patient observation.
Professor Rudolf Kalman
University of Florida at Gainesville
As complexity increases, precise statements lose meaning and meaningful statements lose precision.
Professor Lofti Zadeh
University of California at Berkeley
quoted in McNeill & Freiberger, p 43
So far as the laws of mathematics refer to reality, they are not certain.  And so far as they are certain, they do not refer to reality.
Albert Einstein
in Geometry & Experience

Where are the Fuzzy Systems? - What are They Doing Now?
Fuzzy Logic - Background- Your Goals

        Goals of this lesson are:

Given a system to be controlled,
  Design a simple fuzzy controller using:


Introduction/Background

        Study of Fuzzy logic is a study of a kind of logic.  We are all familiar with some of the principles of logic.  Fuzzy logic builds on traditional logic and extends traditional logic so that fuzzy logic can solve some long standing problems in traditional logic.

        Like many other things, it all started with the ancient Greeks, who first formalized logic.  Aristotle may not have been the first to assert the one statement at the foundations of traditional logic, but he certainly is the earliest on record to have done so.  In one form or another, Aristotle is credited with claiming:

A thing either is or it is not.

        The essence of the claim is that there is no other possibility, and in particular, there is nothing between the two possibilities, and it has come to be known as the law of the excluded middle.  Let's look at some examples.

        Here are some examples of the law of the excluded middle.

        Let's examine those examples of the law of the excluded middle. And that leaves us with only the first statement that we can be comfortable with.

        Now consider this rather horrible little statement.  If all statements are either TRUE or FALSE, which is the case for this statement?

        Think carefully about this statement.  Is it TRUE or is it FALSE?  Consider this then.         Clearly we have a problem here, and it is not trivial.  This is a statement that cannot be either TRUE or FALSE.  But what else can it be?

        Fuzzy logic and fuzzy set theory eliminate paradoxes like the statement above by
assigning a continuum of truth values to statements.

        There's an interesting situation here.         In life we sometimes must accept shades of truth, or grades of truth.         The concept of grades of truth or grades of membership in sets is something that, at this writing, does not seem to come naturally to many even though it is something that many of us actually use in making decisions in our life.         If the underlying reasoning seems a little obscure, then it is time to begin to look at how ideas about fuzzy logic get to be incorporated into products that work better.  That's a pretty good distance to go, so let's get started.
Fuzzy Membership Functions

        An appealing way to represent some ideas about truth of statements and membership functions is to draw a graph of a membership function.

Next is a similar graph.  It represents a membership function for a fuzzy case.

In this fuzzy membership function you can give varying interpretations to what it means.  Here are some examples. This plot lets you compare the fuzzy membership function with the crisp membership function.

        Membership functions are a useful and integral part of fuzzy control systems.  However, in fuzzy control, it is often more convenient to use membership functions that are not smooth - like the one above.  Instead, it is often the case that membership functions are composed of straight lines - because the computation of the membership value is much simpler in that case.

        Here's a membership function of the type we want to examine.  This particular membership
function can be used to determine the truth value of the statement:

The room is very hot.


Problem

P1  Assume that you measure the temperature of the root, and you get 80 degrees.  Determine the truth value of the statement:

"The room is very hot."

Enter your answer in the box below, then click the button to submit your answer.  You will get a grade on a 0 (completely wrong) to 100 (perfectly accurate answer) scale.

Your grade is:



        Here's another kind of membership function.  This membership function gives truth value for the statement:

The room is very cold.


Problem

P2  Assume that you measure the temperature of the root, and you get 60 degrees.  Determine the truth value of the statement:

"The room is very cold."

Enter your answer in the box below, then click the button to submit your answer.  You will get a grade on a 0 (completely wrong) to 100 (perfectly accurate answer) scale.

Your grade is:


        Finally, here's a triangular membership function that gives truth values for the statement:

The temperature of the room is OK.


Problem

P3    Assume that you measure the temperature of the root, and you get 60 degrees.  Determine the truth value of the statement:

"The temperature of the room is OK."

Enter your answer in the box below, then click the button to submit your answer.  You will get a grade on a 0 (completely wrong) to 100 (perfectly accurate answer) scale.

Your grade is:


        Let's review all of these membership functions.  Here they are together.  There's one interesting observation to make.


Fuzzy Control

        Membership functions are a useful and integral part of fuzzy control systems.  Let us examine a control problem that we can solve with a fuzzy approach.  Let's take a look at a very simple fuzzy control system.  We'll use the membership functions from the last section.

        Now, to build/design a control system, we will need something else - something we haven't encountered before - a rule base.  A rule base is exactly what the phrase implies.  It is a set of rules for doing the control.  The rule base tells you how to change the control effort.  Here's an example rule base for a simple fuzzy control system.
        Different colors are used here to show the correlation between the statements in the rule base and the function.  The rule base consists of statements with two parts.  Here's the rule base again.         The statements in bold text are the antecedents, and the regular text parts are the consequents in the rule base.  In any event, this rule base - when implemented - will give us a fuzzy control system.

        Now, let's examine the control algorithm for fuzzy control - proportional and others.  Here's the algorithm.

        We'll take these different steps up separately.  The first step in the algorithm is:         We'll assume that you have a way of measuring temperature and getting the resultant value into a computer program, say one written in C or Visual Basic.

        The second step in the algorithm is:


Problem

P4   Assume that you measure the temperature of the root, and you get 60 degrees.  Determine the firing level of the antecedent statment:

"If the room is very cold, then the control effort is high."

Use this set of graphs for your calculation.

Enter your answer in the box below, then click the button to submit your answer.  You will get a grade on a 0 (completely wrong) to 100 (perfectly accurate answer) scale.

Your grade is:


Problem

P5    Assume that you measure the temperature of the root, and you get 60 degrees.  Determine the firing level of the antecedent statment:

"If the temperature of the room is OK, then the control effort is medium."

Use this set of graphs for your calculation.

Enter your answer in the box below, then click the button to submit your answer.  You will get a grade on a 0 (completely wrong) to 100 (perfectly accurate answer) scale.

Your grade is:


Problem

P6    Assume that you measure the temperature of the root, and you get 60 degrees.  Determine the firing level of the antecedent statment:

"If the room is very hot, then the control effort is low."

Use this set of graphs for your calculation.

Click on the box to enter your answer.



        We need to go a little slower when it comes to computing the control effort.

 Now, we need an algorithm for defuzzification (and isn't that a great word?).

Here are the membership functions for the antecedents again.

Go back to the problems above where you got the firing levels for each of the membership functions.  The firing levels you should have found are as follows.

Then, we are going to multiply these firing levels by L(C), M(C) and H(C) - the membership functions for the control effort.  If we multiply the control effort membership functions by the firing levels, we will get the graphs shown below - which actually contains three graphs!

Here is the sum of those three functions - shown in orange.

        We still have one unanswered question - and it is important.

        Good grief, now we have to remember how to compute a centroid!  Well, here's the definition of the centroid of a function.

Centroid = Moment of Function/Area of Function

        Now, if we can express the centroid as a function of the parameters of the membership functions, we have a chance to get a simple expression.  Let's work on that.         Now, the area of the composite function can be computed.  Note that the areas (integrals) of H(C), M(C) and L(C) all equal W/2, where W is the total width of the triangle.

        Next examine the moment of a triangle function.  Here's the derivation for the moment.



Example

E1   In the graph below, compute the moment of the Medium Control Effort Membership function (shown in blue as M(C)).   Note, for this function:


Putting the values for L, M and R into the expression above, we have:
Problem

P7    In the graph below, compute the moment of the High Control Effort Membership function (shown in black as H(C)).   Note, for this function:


Enter your answer in the box below, then click the button to submit your answer.  You will get a grade on a 0 (completely wrong) to 100 (perfectly accurate answer) scale.

Your grade is:


        Now, let's compute the centroid of the medium function, M(C).  In the example above we found: We can also compute the area as half of the product of the height (1) and the width (from 0 to 100): Then, we know that the centroid is given by: And, that should make sense to you.

Problem

P8   In the graph below, compute the centroid of the High Control Effort Membership function (shown in black as H(C)).   Note, for this function:


Enter your answer in the box below, then click the button to submit your answer.  You will get a grade on a 0 (completely wrong) to 100 (perfectly accurate answer) scale.

Your grade is:


        Now, let's go back to the control computation we were looking at earlier.  We now have all the numerical results we need.  Here is the composite function discussed earlier.  The control effort is the centroid of the composite function.

Previously, we computed the firing levels of the three membership functions for Very Cold, OK (Medium) and Very Hot.  Here are those firing levels.

From these firing levels, we constructed a composite membership function for the Control Effort.  That composite function is shown in the graph above.  It is constructed as follows. The sum of these three functions (Firing level x Control Effort Membership Function) is the orange function shown in the figure.  The "orange" function - the composite function is given by: The centroid for the composite function is the control effort level that we will use in this situation.  That centroid is given by: Here is the function again.

The numerical values for the centroids are:

So, the control law (the computation for the actual control effort) reduces to: Simple as this approach seems, it does often work, and it is a reasonable way to implement a control system.  It has some pros and cons.
Marks of Acceptance of Fuzzy Logic

        At this point, Fuzzy Logic, Fuzzy Set Theory and Fuzzy control are all accepted and widely used.  As illustrations: