Fuzzy Control: Lect 4 Fuzzy Logic Process
Fuzzy Control: Lect 4 Fuzzy Logic Process
Fuzzy Control: Lect 4 Fuzzy Logic Process
Basil Hamed 2
Fuzzy Logic Process
It is one thing to compute, to reason, and to model with
fuzzy information; it is another to apply the fuzzy results
to the world around us.
Despite the fact that the bulk of the information we
assimilate every day is fuzzy, most of the actions or
decisions implemented by humans or machines are
crisp or binary.
The decisions we make that require an action are
binary, the hardware we use is binary, and certainly the
computers we use are based on binary digital
instructions.
Basil Hamed 3
Fuzzy Logic Process
In giving instructions to an aircraft
autopilot, it is not possible to turn the
plane slightly to the west; an autopilot
device does not understand the natural
language of a human. We have to turn the
plane by 15 , for example, a crisp number.
Basil Hamed 4
Fuzzy Logic Process
Crisp Input Fuzzification
Fuzzy Input
Fuzzy Logic
-or-
F.A.M.
Fuzzy Output
De-Fuzzification Crisp Output
Basil Hamed 5
Basil Hamed 6
Fuzzy Systems
Inference
Input Fuzzification Defuzzification Output
Engine
Fuzzy
Knowledge base
Basil Hamed 7
Fuzzification
Fuzzification
Inference
Input Fuzzifier Defuzzifier Output
Engine
Fuzzy
Knowledge base
Basil Hamed 9
FUZZIFICATION
Basil Hamed 10
Fuzzification
Determine degree of membership of sensor reading
Basil Hamed 11
Fuzzification
We use Fuzzy Logic to combine predicates
IF Close-by(right-sensor) AND
FAR(goal-location)
THEN Left
Basil Hamed 12
How tall is Kevin?
Very Tall?
Tall?
Average?
Short?
Very Short?
Basil Hamed 13
How tall is Kevin?
Basil Hamed 14
Fuzzification Rules
1
Degree of Membership
0
2 3 4 5 6 7 8
Input (feet)
Basil Hamed 15
Some Examples:
If you are 5 feet:
Very tall - 0% Very Tall (7 feet)?
Tall - 0% Tall (6 feet)?
Average - 100% Average (5 feet)?
Short - 0% Short (4 feet)?
Very Short - 0% Very Short (3 feet)?
Same as Boolean
logic (so far)
Basil Hamed 16
Examples:
Basil Hamed 17
How tall is Kevin?
Kevin is 6 2
Very Tall -
Tall -
Average -
Short -
Very Short -
Basil Hamed 18
How tall is Kevin?
Kevin is 6 2
Very Tall - 25%
Tall - 75%
Average - 0%
Short - 0%
Very Short - 0%
Basil Hamed 19
Fuzzification
Establishes the fact base of the fuzzy system. It identifies
the input and output of the system, defines appropriate IF
THEN rules, and uses raw data to derive a membership
function.
Consider an air conditioning system that determine the best
circulation level by sampling temperature and moisture
levels. The inputs are the current temperature and moisture
level. The fuzzy system outputs the best air circulation level:
none, low, or high. The following fuzzy rules are used:
1. If the room is hot, circulate the air a lot.
2. If the room is cool, do not circulate the air.
3. If the room is cool and moist, circulate the air slightly.
A knowledge engineer determines membership functions that
map temperatures to fuzzy values and map moisture
measurements to fuzzy values.
Basil Hamed 20
Fuzzy Inference (Expert) Systems
Input_1 Fuzzy
IF-THEN
Input_2 Output
Rules
Input_3
Basil Hamed 21
Inference
Input Fuzzifier Defuzzifier Output
Engine
Inference Engine
Fuzzy
Knowledge base
Basil Hamed 22
Inference
Evaluates all rules and determines their truth
values.
Basil Hamed 23
Inference Engine
Fuzzy rules
based on fuzzy premises and fuzzy
consequences
e.g.
If height is Short and weight is Light then
feet are Small
Short( height) AND Light(weight) =>
Small(feet)
Basil Hamed 24
Graphical Technique of Inference
Basil Hamed 25
Graphical Technique of Inference
Example: 1 1 1
A A
Rule 1: if x1 is ~ 1 and x2 is ~ 2 , then y is ~ B
2 2 2
A A B
Rule 2: if x1 is ~ 1 or x2 is ~ 2 , then y is ~
input(i) = 0.35 input(j) = 55
Basil Hamed 26
Composition
Combines all fuzzy conclusions obtained by inference
into a single conclusion. Since different fuzzy rules
might have different conclusions, consider all rules.
Basil Hamed 28
Remarks
Basil Hamed 29
Fuzzy Logic Rule Base
Basil Hamed 30
Fuzzy Logic Rule Base
Basil Hamed 31
Fuzzy Logic Rule Base
Basil Hamed 32
EXAMPLE
Basil Hamed 33
EXAMPLE
Basil Hamed 34
Fuzzy Logic Rule Base
Basil Hamed 35
Fuzzy Logic Rule Base
Basil Hamed 36
Fuzzy Logic Process
Crisp Input Fuzzification
Fuzzy Input
Fuzzy Logic
-or-
F.A.M.
Fuzzy Output
De-Fuzzification Crisp Output
Basil Hamed 37
Fuzzy Associative Memory (FAM)
Fuzzy Associative Memory
It is a Fuzzy Truth Table
Shows all possible outputs for all possible inputs
Easy to create!
Fuzzy associative memories are transformations
FAM map fuzzy sets to fuzzy sets, units cube to units cube.
Basil Hamed 39
FAMs as mapping
0
0 10 20 30 yn 40
50 100 150 xn 200 Green light duration
Traffic density
Basil Hamed 40
Fuzzy Associative Memories (FAMs)
Basil Hamed 41
Fuzzy Associative Memories (FAMs)
Example: for n = 2
A1 A2 A3 A4 A5 A6 A7
B1 C1 C4 C4 C3 C3
B2 C1 C2
B3 C4 C1 C1 C2
B4 C3 C3 C1 C1 C2
B5 C3 C4 C4 C1 C3
A A1 A7
l = k1 k2 = 7*5=35 rules
B B1 B5
Output: C C1 C4
Basil Hamed 42
Fuzzy Associative Memories (FAMs)
Example:
Non-linear membership function: y = 10 sin x
Basil Hamed 43
Fuzzy Associative Memories (FAMs)
x1 NB NS z PS PB
y z NB z PB z
Basil Hamed 44
Fuzzy Logic Process
Crisp Input Fuzzification
Fuzzy Input
Fuzzy Logic
-or-
F.A.M.
Fuzzy Output
De-Fuzzification Crisp Output
Basil Hamed 45
Defuzzification
(Fuzzy-To-Crisp conversions)
Basil Hamed 46
Defuzzification
Convert the fuzzy value obtained from
composition into a crisp value. This process is
often complex since the fuzzy set might not
translate directly into a crisp value. Defuzzification
is necessary, since controllers of physical systems
require discrete signals.
Defuzzification is the conversion of a fuzzy quantity to
a precise quantity, just as fuzzification is the
conversion of a precise quantity to a fuzzy quantity.
The output of a fuzzy process can be the logical union
of two or more fuzzy membership functions defined on
the universe of discourse of the output variable.
Basil Hamed 47
DEFUZZIFICATION
Defuzzification strategy is aimed at producing a non-fuzzy
control action, or can say defuzzification means the
conversion of the fuzzy output values into crisp values. For
example, if we say "the output force must be large" and large
variable takes the values between (70, 90) N, then what is the
force will be needed 75 or 80 or N, we can know what is
the force we want by using defuzzification method. There are
different types of defuzzification methods.
Basil Hamed 48
Inference
Input Fuzzifier Defuzzifier Output
Engine
Defuzzification
Fuzzy
Knowledge base
Basil Hamed 49
Inference
Input Fuzzifier Defuzzifier Output
Engine
Defuzzification
Fuzzy
Knowledge base
Basil Hamed 50
Inference
Input Fuzzifier Defuzzifier Output
Engine
Defuzzification
Fuzzy
Knowledge base
A ( z ) zdz
zCOA Z
,
Z
A ( z )dz
zdz
zBOA zMOM Z
,
A ( z )dz A ( z )dz,
Z
dz
zBOA
where Z {z; A ( z ) *}
Basil Hamed 51
Centroid
It finds the point where a vertical line would
slice the aggregate set into two equal masses.
Mathematically this centre of gravity (COG) can
be expressed as:
x x dx
A
COG a
b
x dx
a
A
Centroid defuzzification method finds a point
representing the centre of gravity of the fuzzy
set, A, on the interval, ab.
A reasonable estimate can be obtained by
calculating it over a sample of points.
(x)
1.0
0.8
0.6 A
0.4
0.2
a b
0.0 X
150 160 170 180 190 200 210
Centre of gravity (COG):
(0 10 20) 0.1 (30 40 50 60) 0.2 (70 80 90 100) 0.5
COG 67.4
0.1 0.1 0.1 0.2 0.2 0.2 0.2 0.5 0.5 0.5 0.5
Degree of
Membership
1.0
0.8
0.6
0.4
0.2
0.0
0 10 20 30 40 50 60 70 80 90 100
67.4 Z
Centroid
Basil Hamed 55
Defuzzification Methods
Max-membership principle
1
c(Z*) c(z) z Z
z* z
Centroid principle
1
c ( z ) zdz
z
*
c ( z )dz
z* z
Basil Hamed 56
Defuzzification Methods
c ( z ) z .9
z
* ~
c ( z ) .5
~
0 a b z
Mean-max membership
(middle-of-maxima method)
1
z* a b 2
0 a z* b z
Basil Hamed 58
Defuzzification Methods
Example 4.3:
A railroad company intends to lay a new rail line in a particular part of a
county. The whole area through which the new line is passing must be
purchased for right-of-way considerations. It is surveyed in three stretches,
and the data are collected for analysis. The surveyed data for the road are
given by the sets B~ 1,B~ 2 and B~ 3 , where the sets are defined on the universe of
right-of-way widths, in meters. For the railroad to purchase the land, it must
have an assessment of the amount of land to be bought. The three surveys
on the right-of-way width are ambiguous , however, because some of the
land along the proposed railway route is already public domain and will not
need to be purchased. Additionally, the original surveys are so old (circa
1860) that some ambiguity exists on the boundaries and public right-of-way
for old utility lines and old roads. The three fuzzy sets B~ 1,B~ 2 and B~ 3 , shown in
the figures below, represent the uncertainty in each survey as to the
membership of the right-of-way width, in meters, in privately owned land.
We now want to aggregate these three survey results to find the single most
nearly representative right-of-way width (z) to allow the railroad to make its
initial estimate
Basil Hamed 59
Defuzzification Methods
Basil Hamed 60
Defuzzification Methods
Centroid method:
z *
( z ) zdz
B
~
( z)dz
B
~
1 4 z 3
3.6 5.5 6 7 8
0 (. 3 z ) zdz 1 (. 3 z ) dz 3.6 2 4
zdz (. 5) zdz 5.5 z 5 zdz 6 zdz 7 8 z zdz
1 4 z 3
.3z dz (.3)dz
3.6 5.5 6 7 8
dz (.5)dz ( z 5)dz dz (8 z )dz
0 1 3.6
2 4 5.5 6 7
4.9meters
Basil Hamed 61
Defuzzification Methods
Weighted-Average Method:
z *
.3 2.5 .5 5 1 6.5
5.41meters
.3 .5 1
Basil Hamed 62
Defuzzification Methods
Basil Hamed 63
Defuzzification Methods
Basil Hamed 64
Defuzzification Methods
Basil Hamed 65
Defuzzification Methods
z *
( z ) zdz
B
~
( z)dz
B
~
Basil Hamed 67
Defuzzification Methods
z *
11.5 1 2 1 3
2.25
111
Basil Hamed 68
Defuzzification Methods
Basil Hamed 69
Defuzzification Methods
Center of sums Method
Faster than any defuzzification method
Involves algebraic sum of individual output fuzzy sets,
instead of their union
Drawback: intersecting areas are added twice.
z C z dz
n
k 1
* z ~k
z
C z dz
n
z k 1 ~k
Basil Hamed 71
First (or last) of maxima: This method uses the overall
output or union of all individual output fuzzy sets Ck to
determine the smallest value of the domain with
maximized membership degree in Ck.
Basil Hamed 72
Picking a Method
Basil Hamed 73
EXAMPLES
EXAMPLE 1
Basil Hamed 75
EXAMPLE 1
Basil Hamed 76
EXAMPLE 1
Basil Hamed 77
EXAMPLE 1
Basil Hamed 78
EXAMPLE 1
Basil Hamed 79
EXAMPLE 1
Basil Hamed 80
Solar Pool Heater Example
suppose we measure the pool water temp and the
wind speed and we want to adjust the valve that
sends water to the solar panels
Basil Hamed 81
Solar Pool Heater Example
set up membership functions for the inputs
for each input, decide on how many categories there will be
and decide on their membership functions
cold
nominal warm
cool hot calm
strong
brisk
60 70 80 90 100 F 4 12 20 mph
-10 -5 0 5 10 degrees
change_in_valve
Basil Hamed 83
Solar Pool Heater Example
Basil Hamed 84
Solar Pool Heater Example
Fuzzify the inputs
cold
nominal warm
0 cool hot calm
0.35 0.6
strong
0 0 0.4 brisk
0.55 0
60 70 80 90 100 F 4 12 20 mph
.6
.55
Basil Hamed 88
HW 3
4.9, 4.10, 5.12, 6.1, 6.4
In Problem 4.9, and 4.10 use any 3
methods for defuzzification.
Due 13/11/2012
Good Luck
Basil Hamed 89