You are on page 1of 19

05/11/2017

What Is Fuzzy Logic (FL)

Fuzzy Logic
Fuzzy Logic
— Fuzzy logic is conceptually easy to understand. The
mathematical concepts behind fuzzy reasoning are
very simple.

— Fuzzy logic is tolerant of imprecise data.

— Fuzzy logic can model nonlinear functions of arbitrary


complexity. You can create a fuzzy system to match any
set of input-output data.
http://www.mathworks.com/help/fuzzy/what-is-fuzzy-logic.html

1
05/11/2017

Fuzzy Logic Fuzzy Logic


— Fuzzy Logic was first proposed by Lotfi Zadeh, in a
classical paper published 1965.

— In a classical sets, or crisp sets, the transition between


membership and non-membership in a given set for an
element in the universe of discourse is abrupt and
well-defined.

— In fuzzy sets this transition can be gradual.

Fuzzy Logic Degree of Membership


A very clear example for this concept is the speed of a car and
how we can express it.

Crisp set
ì1, speed Î [0,30] ü
m slow (speed ) = í ý
î0, speed Ï [0,30]þ

Fuzzy set

• Fuzzy variable is speed with


three membership function
• Universe of discourse
between 0 to 120

2
05/11/2017

Degree of Membership Fuzzy Sets & Membership Functions

Crisp set

Fuzzy set

Classical Sets Fuzzy Sets


A classical set might be expressed as — Formal definition:
A fuzzy set A in X is expressed as a set of ordered pairs:
A = { x | x > 6}
A = {( x , m A ( x ))| x Î X }
The membership of any Value of x is either 0 or 1
Fuzzy set Membership Universe or
0 if x ≤ 6 function universe of discourse
1 if x > 6 (MF)

A fuzzy set is totally characterized by a


membership function (MF).

3
05/11/2017

Fuzzy Sets with Discrete Universes Fuzzy Sets with Continuous Universes
— Fuzzy set C = “desirable city to live in”
X = {Dammam, Jeddah, Riyad} (discrete universe) — Fuzzy set B = “about 50 years old”
C = {(Dammam, 0.9), (Jeddah, 0.8), (Riyad, 0.6)} X = Set of positive real numbers (continuous)
— Fuzzy set A = “sensible number of children”
X = {0, 1, 2, 3, 4, 5, 6} (discrete universe) B = {(x, mB(x)) | x in X}
A = {(0, .1), (1, .3), (2, .7), (3, 1), (4, .6), (5, .2), (6, .1)}
1
mB( x) =
æ x - 50ö
2

1+ ç ÷
è 10 ø

Membership Functions Membership Functions

Standard Deviation
Mean

4
05/11/2017

Membership Functions Membership Functions

1
1

Membership Functions Membership Functions

zmf
pimf

smf

5
05/11/2017

Fuzzy Partition
— Fuzzy partitions formed by the linguistic
Set-Theoretic Operations
values “young”, “middle aged”, and “old”:

Set-Theoretic Operations
Set-Theoretic Operations
— Subset:
A Í B Û mA £ mB

— Complement:
A = X - A Û mA ( x ) = 1 - mA ( x )
— Union:
C = A È B Û mc ( x ) = max( mA ( x ), mB ( x )) = mA ( x )Ú mB ( x )
— Intersection:
C = A Ç B Û mc ( x ) = min( mA ( x ), mB ( x )) = m A ( x )Ù mB ( x )

6
05/11/2017

Set-Theoretic Operations If-Then Rules


If < (antecedent)> Then <(consequent)>

Rule 1: If (Motor Speed is slow) then Voltage increase is High

Rule 2: If (Motor Speed is slow and acceleration is high)


then Voltage increase is Low

Interpreting an if-then rule involves two steps:


1. Evaluation of the antecedent — Fuzzifying the
subset
inputs and applying any necessary fuzzy operators.
2. Application of the result to the consequent.
Implication: if p is true, then q is also true (p → q). In fuzzy logic, if p is true to
some degree of membership, then q is also true to the same degree (0.5p → 0.5q)
Fuzzy set operation

If-Then Rules Interpretation If-Then Rules Interpretation


Interpreting if-then rules is a three-part process. Step 2: Apply fuzzy operator to multiple part antecedents:
Step 1: Fuzzify inputs: Resolve all fuzzy statements in the apply fuzzy logic operators and resolve the antecedent
antecedent to a degree of membership between 0 and 1. to a single number between 0 and 1. This is the degree
of support for the rule.

7
05/11/2017

If-Then Rules Interpretation Fuzzy Inference Process


Fuzzy inference is the process of mapping from a given input to
Step 3: Apply implication method: Use the degree of
an output using fuzzy logic
support for the entire rule to shape the output fuzzy
set

Types of Fuzzy Inference Systems Mamdani-Type Fuzzy Inference


There are two types of fuzzy inference systems — Mamdani's fuzzy inference method is the most commonly seen
according to the way outputs are determined: fuzzy methodology.
— Mamdani's method was among the first control systems built
— Mamdani Type:
using fuzzy set theory.
— Output membership functions are fuzzy sets
— It was proposed in 1975 by Ebrahim Mamdani [1] as an attempt
— Typical rule is
to control a steam engine and boiler combination by
If X is A1 and Y is B1 then Z is C1
synthesizing a set of linguistic control rules obtained from
— Sugeno Type: experienced human operators.
— Output membership functions are either linear or constant — Mamdani-type inference expects the output membership
— Typical rule is functions to be fuzzy sets. After the aggregation process, there
If X is A1 and Y is B1 then Z = p1*x + q1*y + r1 is a fuzzy set for each output variable that needs
defuzzification.

8
05/11/2017

Fuzzy Inference Process Defuzzification


The input for the defuzzification
process is the aggregate output fuzzy
set and the output is a single number.
There are some widely used
defuzzification methods:
1. Max membership
2. Centroid
3. Weighted average
4. Mean of maximum
The most popular defuzzification
method is the centroid calculation,
which returns the center of area
under the curve, as shown.

Defuzzification Defuzzification
1. Max membership principle: Also known as the height 2. Centroid method: This procedure (also called center of
method, this scheme is limited to peaked output functions. area, center of gravity) is the most prevalent and physically
appealing of all the defuzzification methods

Max membership defuzzification method


Centroid defuzzification method

9
05/11/2017

Defuzzification Defuzzification
3. Weighted average method: The weighted average method 4. Mean max membership: This method (also called
is the most frequently used since it is one of the more middle-of-maxima) is closely related to the first method,
computationally efficient methods. Unfortunately it is usually except that the locations of the maximum membership can
restricted to symmetrical output membership functions

Weighted average defuzzification method Mean max membership defuzzification method

Defuzzification: Example Defuzzification: Example


Defuzzify the aggregate output fuzzy set is shown below using:
1. Mean of max method 1. Mean of max method
2. Weighted average method
3. Centroid method z∗ = (6 + 7)/2 = 6.5

10
05/11/2017

Defuzzification: Example Defuzzification: Example


2. Weighted average method 3. Centroid method

Defuzzification: Example Fuzzy Inference Diagram


3. Centroid method

Fuzzification Fuzzy Operations -


Implication Aggregation
Defuzzification

11
05/11/2017

Sugeno-Type Fuzzy Inference Sugeno-Type Fuzzy Inference


— The first two parts of the fuzzy inference process, — Each rule weights its output level, zi, by the firing
fuzzifying the inputs and applying the fuzzy operator, strength of the rule, wi
are the same as Mamdani — The final output of the system is the weighted average
— The main difference is that the Sugeno output of all rule outputs, computed as
membership functions are either linear or constant.
— A typical rule in a Sugeno fuzzy model has the form:
If Input 1 is x and Input 2 is y, then
Output is z = ax + by + c
— For a zero-order Sugeno model, the output level z is a
constant (a = b = 0). where N is the number of rules

Sugeno-Type Fuzzy Inference Sugeno-Type Fuzzy Inference


— A Sugeno solution for tipping example
— A Sugeno rule operates as shown

12
05/11/2017

Sugeno vs. Mamdani Systems


Type-2 Fuzzy Membership
Advantages of Sugeno Type
–computationally efficient
–works well with linear techniques (e.g., PID control)
–works well with optimization and adaptive techniques
–has guaranteed continuity of the output surface
–It is well suited to mathematical analysis
Advantages of Mamdani Type
–intuitive.
–has widespread acceptance.
Type-1 Type-2
–well suited to human input.
MATLAB function mam2sug converts a Mamdani system into a Sugeno system with constant output

Type-1 Fuzzy Inference Type-2 Fuzzy Inference

13
05/11/2017

History of FLC in the Industry


Fuzzy Logic Control
— The first industrial application, a cement furnace built
— Fuzzy control is the most active area of fuzzy logic application. in Denmark in 1975.
— The research started by Mamdani and his students (1965) by — In Japan, Interest in fuzzy systems was sparked by Seiji
applying fuzzy control to steam engine. Yasunobu and Soji Miyamoto of Hitachi, who in 1985
— Many researches and applications are carried out different provided simulations that demonstrated the
process like vehicle, aircraft, spacecraft, robots ...etc. superiority of fuzzy control systems for the Sendai
— These research conclude that fuzzy control can work well for ill railway.
defined systems in which mathematical model can not be
— Their ideas were adopted, and fuzzy systems were used
obtained.
to control accelerating, braking, and stopping when
— It also gives good performance and it is more robust if it is
the line opened in 1987.
designed well.

History of FLC in the Industry History of FLC in the Industry


— Another event in 1987 helped promote interest in fuzzy v Following such demonstrations, the Japanese became crazed
systems. During an international meeting of fuzzy researchers with fuzzy systems, developing them for both industrial and
in Tokyo, Takeshi Yamakawa demonstrated the use of fuzzy consumer applications. In 1988 they established the Lab for
control, through a set of simple dedicated fuzzy logic chips, in International Fuzzy Engineering (LIFE), a cooperative
an "inverted pendulum" experiment. Observers were arrangement between 48 companies to pursue fuzzy
impressed with this demonstration research. Japanese companies developed a wide range of
— In another experiment, Yamakawa mounted a water glass or products using fuzzy logic, ranging from washing machines
even a live mouse to the top of the pendulum. The system to autofocus cameras and industrial air conditioners.
maintained stability in both cases.
v Some work was also performed on fuzzy logic systems in the
US and Europe, and a number of products were developed
using fuzzy logic controllers

14
05/11/2017

Configuration of FLC
Scaling Factors
— They are the factors by which the inputs to the control
system are multiplied to make them lie in the range of the
universe of discourse of these fuzzy variables.
— They play an important role in the system response because
they are similar to the parameters of the PD controller
except that the output is limited by a certain value.
— If the range of discourse normalized to the range of [-L, L]
then the scaling factors are determined from E, CE, and U
(Error, Change of Error, control signal)

L L U
KE = K CE = K = m ax
E max C E m ax U
L

Fuzzification
— The fuzzification involves two main functions:
Decision Making
— Scaling the crisp controller inputs and — It is the heart of the FLC, having the capability of simulating
human decision making on fuzzy concepts
— converting them into the corresponding
linguistic values. — Basically, decision-making logic performs the function of
processing and evaluating fuzzy control rules.
— This part makes two tasks generating rules and inferring the
output from these rules due to the system inputs.
— Rules are the most important part of any FLC. It linguistically
defines the control policy of the controller

If < (antecedent)> Then <(consequent)>

15
05/11/2017

Generating the Fuzzy Rules


Generating the Fuzzy Rules
(1) Experts Experience and Engineering Sense
— If the process under control works well by an operator then it (2) Modeling Operator's Control Actions
is very useful to make an interview with this operator and get
the know-how from him and express this in terms of fuzzy When we drive a car, we control it by using our
implications. hands and feet. The information the driver uses
— The disadvantages of this method of design is drawn from to decide his action is the input to the controller
the fact that, in this case.
— firstly, the operator may not be able to explain his secrets
linguistically, and
If the input to the driver and the action from him is
— secondly, when the process is complex, the engineer's sense finds recorded, this data is used to generate the rules
difficulty to write down the control rules for this process. Then this that he uses to drive the car
method is essentially heuristic.
— So, it is very difficult to give a general design procedure.

de&&

Generating the Fuzzy Rules


Example of PD-FLC Rules
(3) Using Optimization Techniques
— The optimization techniques can be used to generate the rules u E (error)
to get certain performance by minimizing a prescribed index
CE
(4) Self Organization NB NS ZO PS PB
Change of Error
— The above methods do not take into account parameter
NB NB NB NS NS ZO
variation of the process or when a situation beyond the
operator experience occurs then the system performance NS NB NS NS ZO PS

deteriorates.
ZO NS NS ZO PS PS
— Self organizing represents a good method in such cases. This
method depends on supervised rules by which the fuzzy rules PS NS ZO PS PS PB

are generated depending on the deviation of the system PB ZO PS PS PB PB


performance from the prescribed optimal one.

16
05/11/2017

Fuzzy Inference
Fuzzy Inference
— Rules: R1: if e=E1 and ce=CE1 then u=U1
— By inference we mean obtaining the controller output fuzzy — R2: if e=E2 and ce=CE2 then u=U2
set from the controller input and the control rules by
compositional rule of inference
— The membership function for each rule and the
corresponding output fuzzy set is first obtained using
minimum or product implication operators, then, the final
output fuzzy set is obtained using union (maximum).
— Introduce the operations on fuzzy sets
Graphical Interpretation for rule by rule fuzzy decision making using
Min. fuzzy implication

Fuzzy Control: Inverted Pendulum Partition variables


State variables Problem
Angle of the Keep pendulum
Pendulum upright by Pendulum Angle
moving cart left
Rate of change of
or right.
the angle
Inputs
Position of the
cart
Pendulum Angular
Velocity

Output Cart Speed

http://www.flll.uni-linz.ac.at/aboutus/whatisfuzzy/introduction.html

17
05/11/2017

Controller Rules Inputs


If angle is zero and angular velocity is zero
then speed shall be zero. Input is both zero
and positive low.
Angle
Negative Negative Zero Positive Positive
High Low Low High
Negative Negative
High High
Velocity

Negative Zero Negative Zero


Angle

Low Low
Zero Negative Negative Zero Positive Positive Input is both zero
High Low Low High
Positive Zero Positive Zero and negative low.
Low Low
Positive Positive
High High

How many rules will be fired?


This is an example of a Fuzzy PD Controller!

Example Output from one rule Output from Four Rules


if angle is zero and angular
if angle is zero and angular velocity is zero then
velocity is zero then

if angle is zero and angular


velocity is negative low then

if angle is positive low and


angular velocity is zero then
Defuzzification must
now be done on fused
if angle is positive low and angular
velocity is negative low then output.

18
05/11/2017

Recommended References
1. Li-Xin Wang, Jerry M. Mendel, "Generating Fuzzy Rules by Learning from
Examples", IEEE Trans. on syst. , man, and cybern., November 1992, pp. 1414-1427
2. S.Daley, K.F. Gill, "A Design Study of a Self-Organizing Fuzzy Logic Controller",
Procd. Instn., Mech. Engns. , Vol. R00, No. c1, 1986, pp. 59-69

Matlab Fuzzy Toolbox: http://www.mathworks.com/help/pdf_doc/fuzzy/fuzzy.pdf

Videos
http://www.mathworks.com/videos/getting-started-with-fuzzy-logic-toolbox-part-1-
68764.html
http://www.mathworks.com/videos/getting-started-with-fuzzy-logic-toolbox-part-2-
68765.html
http://www.mathworks.com/videos/getting-started-with-fuzzy-logic-toolbox-part-3-
68766.html
http://www.mathworks.com/help/fuzzy/examples/defuzzification-
methods.html?prodcode=FL&language=en

19

You might also like