Académique Documents
Professionnel Documents
Culture Documents
EPM643
“No doubt Prof. Zadah’s enthusiasm for fuzziness has been reinforced
by prevailing political climate in the U.S.- one of unprecedented
permissiveness. ‘Fuzzification’ is a kind of scientific permissiveness; it
tends to result in socially appealing slogans unaccompanied by
discipline of hard scientific work and patient observation.
I must confess that I can not conceive of ‘fuzzification’ as a viable
alternative for scientific method”
14/10/2009 Dr. Khaled El-Metwally, CU - FL2017 5
Western Scientists Views
William Kahan is an mathematician and a collogue of Zadah’s at Berkely University. In
1975 he pointed out;
“Logic is not following the rules of Aristolte blindly. It takes the kind
of pain known to the runner. He knows he is doing something.
When you think of something hard, you’ll feel a similar sort of
pain.
Fuzzy logic is marvelous. It insulates you form pain. It’s the cocaine
of science.”
14/10/2009 Dr. Khaled El-Metwally, CU - FL2017 6
Why fuzzy?
As Zadeh said, the term is concrete, immediate and
descriptive; we all know what it means. However,
many people in the West were repelled by the word
fuzzy, because it is usually used in a negative sense.
Why logic?
Fuzziness rests on fuzzy set theory, and fuzzy logic is
just a small part of that theory.
•Sharper TV pictures.
•Video Stabilizers.
Fuzzy Sets
• Linguistic uncertainty
– E.g., low price, tall people, young age
• Informational uncertainty
– E.g., credit worthiness, honesty
Young ( y)
1
25 y
Fuzzy Sets
A ( x) [0,1]
Example
Young ( y)
1
A ( x, A ( x)) x U
membership
function
U : universe of
discourse.
A : U [0,1]
Revised Oct.2017 Dr. Khaled El-Metwally, CU 18
Example: Discrete Fuzzy Sets with
Discrete Universes
• Fuzzy set C = “desirable city to live in”
X = {Cairo, Alex, Asswan} (discrete and nonordered)
C = {(Cairo, 0.9), (Alex, 0.8), (Asswan, 0.6)}
• Fuzzy set A = “sensible number of children”
X = {0, 1, 2, 3, 4, 5, 6} (discrete universe)
A = {(0, .1), (1, .3), (2, .7), (3, 1), (4, .6), (5, .2), (6, .1)}
A ( x)
0.5
0
2 4 6 8
x : # courses
Alternative Representation:
B ( x, B ( x)) x U
1 about 50 years old
B ( x)
x 50
4
1
5 1.2
0.8
Alternative
Representation: B ( x) 0.6
0.4
B
0.2
1
x
0
R 1 x50 4
5 0 20 40 60 80 100
x : age
Revised Oct.2017 Dr. Khaled El-Metwally, CU 22
Alternative Notation
A ( x, A ( x)) x U
U : discrete universe A
xi U
A ( xi ) / xi
U : continuous universe A A ( x) / x
U
Note that and integral signs stand for the union of membership grades;
“ / ” stands for a marker and does not imply division.
“tall” in Asia
Membership
1
value
“tall” in USA
“tall” in NBA
0
5’10” height
2- MF Formulation
xa d x
• Trapezoidal MF trapmf ( x; a, b, c, d ) max min ,1, , 0
b a d c
2
1 x c
• Gaussian MF gaussmf (x ; , c ) e 2
1
• Generalized bell MF gbellmf ( x; a, b, c)
xc
2b
1
a
1
cross points a
Slope =-b/2a
1
MF
0.5
0
x
core
2a width
-cut
support
Revised Oct.2017 Dr. Khaled El-Metwally, CU 29
Manipulating Parameter of the
Generalized Bell Function
1
gbellmf ( x; a, b, c)
xc
2b
1
a
Extensions:
Abs. difference
of two sig. MF
Product
of two sig. MF
Example: FL ( x) max(0,1 x 2 )
FR ( x) exp x 3
c=65 c=25
=60 =10
=10 =40
• Normality 1
(x)
– core non-empty
• Fuzzy singleton 0
– support one single point Small Medium Big
• Fuzzy numbers
– fuzzy set on real line R that satisfies convexity and
normality
• Symmetricity 1
(x)
A (c x) A (c x), x U
0
• Open left or right, closed height
1
lim A ( x) 1, lim A ( x) 0
(x)
x x
0 age
Revised Oct.2017 Dr. Khaled El-Metwally, CU 33
Introduction to Fuzzy Set Theory
3- Set Operations
• Subset
A B
A B A ( x) B ( x), x U
A
• Complement
A U A A ( x ) 1 A ( x)
A B
A B
• Union
C A B C ( x) max( A ( x), B ( x)) A ( x) B ( x)
• Intersection
C A B C ( x) min( A ( x), B ( x)) A ( x) B ( x)
0 0.8
1 NOT 0.2 1-
T-norm
• Generalized Union
T-conorm
Revised Oct.2017 Dr. Khaled El-Metwally, CU 38
Examples: T-Norm & T-Conorm
• Minimum/Maximum:
T (a, b) min(a, b) a b
S (a, b) max(a, b) a b
• Lukasiewicz:
T (a, b) max(a b 1,0) LAND(a, b)
S (a, b) min(a b,1) LOR(a, b)
• Probabilistic:
T (a, b) ab PAND(a, b)
S (a, b) a b ab POR(a, b)
Revised Oct.2017 Dr. Khaled El-Metwally, CU 39
Introduction to Fuzzy Set Theory
4- Extension Principle
B f ( A)
B
x
B(y) A
A(x)
B
B f ( A)
x
B(y)
A(x)
A
x
y y = f(x)
B
B f ( A)
x
B(y)
A(x)
A
x
y y = f(x) B ( y ) f ( A) ( y )
B max ( x )
1 A
x f ( y)
x
sup A ( x)
B(y) x f 1 ( y )
A(x)
A
Revised Oct.2017 x 44
Dr. Khaled El-Metwally, CU
Extension Principle
A is a fuzzy set on X :
A A ( x1 ) / x1 A ( x2 ) / x2 A ( xn ) / xn
The image of A under f( ) is a fuzzy set B:
B B ( y1 ) / y1 B ( y2 ) / y2 B ( yn ) / yn
where yi = f(xi), i = 1 to n.
5-Fuzzy Relations
R A B
Revised Oct.2017 Dr. Khaled El-Metwally, CU 48
Binary Relation (R)
R A B
b1
a1
b2
A a2
a3
b3 B
b4
a4 b5
R ( x, y), R ( x, y) | ( x, y) X Y
1 0.8 0.3 0 0
1 u v 0 0.8 1 0.8 0.3 0
0.8 u v 1 M R 0.3 0.8 1 0.8 0.3
R (u, v)
0.3 u v 2
0 otherwise 0 0.3 0.8 1 0.8
0 0 0.3 0.8 1
R a b c d S
1 0.1 0.2 0.0 1.0 a 0.9 0.0 0.3
2 0.3 0.3 0.0 0.2 b 0.2 1.0 0.8
3 0.8 0.9 1.0 0.4 c 0.8 0.0 0.7
0.1 0.2 0.0 1.0
d 0.4 0.2 0.3
min 0.9 0.2 0.8 0.4
max 0.1 0.2 0.0 0.4
R S
1 0.4 0.2 0.3
2 0.3 0.3 0.3
3 0.8 0.9 0.8
Revised Oct.2017 Dr. Khaled El-Metwally, CU 54
Max-min composition is not mathematically tractable,
therefore other compositions such as max-product
composition have been suggested.
Max-Product Composition
X Y Z R: fuzzy relation defined on X and Y.
R S (x, z) max y R ( x, y) S ( y, z)
R
RY R Y RX R X
RY R Y RX R X
max R ( x, y) / y maxR ( x, y) / x
Y x X y
R ( y) max R ( x, y) R ( x) max R ( x, y)
X
Y y
x
6- Linguistic Variables
x, T ( x),U , G, M
Name
Term Set
Universe
Syntactic Rule
Semantic Rule
x, T ( x),U , G, M
age
Example semantic rule:
𝑇 𝑎𝑔𝑒 = {𝑜𝑙𝑑, 𝑣𝑒𝑟𝑦 𝑜𝑙𝑑, 𝑦𝑜𝑢𝑛𝑔, 𝑞𝑢𝑖𝑡𝑒 𝑦𝑜𝑢𝑛𝑔, }
M (old) u, old (u) u [0,100]
0 u [0,50]
1
old (u ) u 50 2
[0, 100] 1 u [50,100]
5
(x)
cold warm hot
1
20 60 x
Extremely old
Revised Oct.2017
complv.m
Dr. Khaled El-Metwally, CU 67
Operations on Linguistic Values (Hedges )
Concentration: CON ( A) A2
7- Fuzzy Rules
A B If x is A then y is B.
antecedent consequence
or or
premise conclusion
A B If x is A then y is B.
If pressure is high, then volume is small.
A B If x is A then y is B.
R
A fuzzy rule can be defined as a
binary relation with MF R x, y AB x, y
Depends on how
to interpret A B
B B
xx xx
A A
Revised Oct.2017 Dr. Khaled El-Metwally, CU 73
Interpretations of A B
R x, y AB x, y ?
t-norm
xx xx
A A
Revised Oct.2017 Dr. Khaled El-Metwally, CU 74
Interpretations of A B
R x, y AB x, y ?
E.g.,
xx x
R x, y min A ( x), B ( y)x
A A
Revised Oct.2017 Dr. Khaled El-Metwally, CU 75
Introduction to
Fuzzy Set Theory
8- Fuzzy Reasoning
Rule: if x is A then y is B
Fact: x is A’
Conclusion: y is B’
Rule: if x is A then y is B
Fact: x is A’
Conclusion: y is B’
( x) A ( y) B
A’
x y
Revised Oct.2017 Dr. Khaled El-Metwally, CU 80
Fuzzy Reasoning
Single Rule with Single Antecedent
R ( x, y) ( x) B ( y)
A
Max-Min Composition
Rule: if x is A then y is B
B ( y) max x min A ( x), R ( x, y)
Fact: x is A’
x A ( x) R ( x, y)
x A ( x) A ( x) B ( y)
Conclusion: y is B’
x A ( x) A ( x) B ( y)
Firing Strength
Firing Strength
( x) A ( y) B
A’
B
x y
Revised Oct.2017 Dr. Khaled El-Metwally, CU 81
Fuzzy Reasoning
Single Rule with Single Antecedent
R ( x, y) A ( x) B ( y)
Max-Min Composition
Rule: if x is A then y is B
B ( y) max x min A ( x), R ( x, y)
Fact: x is A’
x A ( x) R ( x, y)
x A ( x) A ( x) B ( y)
Conclusion: y is B’
x A ( x) A ( x) B ( y)
B A ( A B)
( x) A ( y) B
A’
B
x y
Revised Oct.2017 Dr. Khaled El-Metwally, CU 82
Summary
Single rule with Single antecedent
B A R A ( A B)
B ( y) [ A ( x) A ( x)] B ( y)
x
B ( y ) w B ( y )
Firing Strength
Revised Oct.2017 Dr. Khaled El-Metwally, CU 83
Fuzzy Reasoning
Single Rule with Multiple Antecedents
Fact: x is A’ and y is B’
Conclusion: z is C’
Fact: x is A’ and y is B’
Conclusion: z is C’
( x) ( y) ( z)
A A’
B’ B C
x y z
Revised Oct.2017 Dr. Khaled El-Metwally, CU 85
R A B C
Fuzzy Reasoning
Rule: if x is A and y is B then z is C
( x, y, z) ( x, y, z)
Single
Fact: Rule
x is A’ and y is B’with Multiple Antecedents R AB C
Conclusion: z is C’
A ( x) B ( y) C ( z)
Max-Min Composition
C ( z ) max x, y min A, B ( x, y), R ( x, y, z)
x, y A, B ( x, y) R ( x, y, z )
x, y A ( x) B ( y) A ( x) B ( y) C ( z)
x A ( x) A ( x) y B ( y) B ( y) C ( z)
Firing Strength
( x) ( y) ( z)
A A’
B’ B C
C
x y z
Revised Oct.2017 Dr. Khaled El-Metwally, CU 86
R A B C
Fuzzy Reasoning
Rule: if x is A and y is B then z is C
( x, y, z) ( x, y, z)
Single
Fact: Rule
x is A’ and y is B’with Multiple Antecedents R AB C
Conclusion: z is C’
A ( x) B ( y) C ( z)
Max-Min Composition
C ( z ) max x, y min A, B ( x, y), R ( x, y, z)
x, y A, B ( x, y) R ( x, y, z )
C A B A B C
( x ) ( y ) ( x) ( y ) ( z )
x, y A B A B C
Firing Strength
( x) ( y) ( z)
A A’
B’ B C
C
Revised Oct.2017 x Dr. Khaled El-Metwally, CU y z
87
Fuzzy Reasoning
Multiple Rules with Multiple Antecedents
( x) ( y) ( z) C1
A’ A1 B1 B’
x y z
( x) ( y) ( z)
A’ A2 B2 B’ C2
x y z
Max
C A B R1 R2 ( z)
A B R1 A B R2 C C1 C2
C1 C2
Revised Oct.2017 Dr. Khaled El-Metwally, CU z
Summary
Single rule with multiple antecedent
Rm ( A, B, C ) A B C A B C
Rm ( A, B, C )
X Y Z
A ( x) B ( y ) C ( y ) /( x, y, z )
C ( A B) ( A B C )
C ( z ) [ A ( x) B ( y) A ( x) B ( y ) C ( z )]
x, y
C ( z ) [ A ( x) A ( x)] [ B ( y ) B ( y )] C ( z )
x y
C ( z ) w1 w2 C ( z )
Firing Strength
Revised Oct.2017 Dr. Khaled El-Metwally, CU 91
Introduction to Fuzzy Control Systems
X ( X) Inference ( Y) Y
Fuzzifier Defuzzifier
Engine
Fuzzy
Knowledge
Base
Fuzzy
Knowledge
Base
Fuzzy
Knowledge
Base
Fuzzy
Fuzzy
Knowledg
Knowledge
eBase
Base
Knowledge Base
Data base Rule base Data base
2- Fuzzy Inference
Rule r fuzzy
wr
x is Ar y is Br
A1 B1 C1
w1
Z
X Y
A2 B2 C2
w2
Z
X Y
x=3 y=2
Min
C’
Revised Oct.2017 Dr. Khaled El-Metwally, CU Z 103
z COA
Defuzzification
*
Largest of Max.
Smallest of Max.
Bisector of Area
10
0.5
8
0
-10 -5 0 5 10
X 6
Y
small medium large
Membership Grades
1 4
0.5 2
0 0
0 2 4 6 8 10 -10 -5 0 5 10
Revised Oct.2017 Y Dr. Khaled El-Metwally, CU X 106
Mamadani Eample 1
small large
1
0.5
0
-5 0 5
X
small large
1
2
0.5
0
Z
0 -2
-5 0 5
Y
large negative small negative small positive large positive 5
1
5
0
0
0.5 Y -5 -5 X
0
-5 0 5
Revised Oct.2017 Dr. Khaled El-Metwally, CU 108
Z
2-Sugeno fuzzy inference
Mamdani-style inference, as we have just seen,
requires us to find the centroid of a two-dimensional
shape by integrating across a continuously varying
function. In general, this process is not
computationally efficient.
Michio Sugeno suggested to use a single spike, a
singleton, as the membership function of the rule
consequent. A singleton, or more precisely a fuzzy
singleton, is a fuzzy set with a membership function
that is unity at a single particular point on the
universe of discourse and zero everywhere else.
Revised Oct.2017 Dr. Khaled El-Metwally, CU 109
Sugeno-style fuzzy inference is very similar to the
Mamdani method. Sugeno changed only a rule
consequent. Instead of a fuzzy set, he used a
mathematical function of the input variable. The
format of the Sugeno-style fuzzy rule is
IF x is A
AND y is B
THEN z is f (x, y)
where x, y and z are linguistic variables; A and B
are fuzzy sets on universe of discourses X and Y,
respectively; and f (x, y) is a mathematical
function.
X Y
A2 B2 z2 =
w2 p2*x+q2*y+r2
X Y w1*z1+w2*z2
x=3 y=2 z=
Min w1+w2
Y
0.4
2
0.2
0 0
-10 -5 0 5 10 -10 -5 0 5 10
X X
(c) Antecedent MFs for Fuzzy Rules (d) Overall I/O Curve for Fuzzy Rules
8
small medium large
Membership Grades
1
6
0.8
0.6 Y 4
0.4
2
0.2
0 0
-10 -5 0 5 10 -10 -5 0 5 10
X X
Revised Oct.2017 Dr. Khaled El-Metwally, CU 114
Sugeno Example 2
Small Large
1
0.5
0
-5 0 5
X
Membership Grades
Small Large
1
0.5
0
-5 0 5
Y
A1 B1 C1
w1
Z
X Y z1
A2 B2 C2
w2
Z
X Y z2
x=3 y=2
Min
w1*z1+w2*z2
z=
w1+w2
Revised Oct.2017 Dr. Khaled El-Metwally, CU 117
Tsukamoto Example
Membership Grades
1 1
0.5 0.5 C1 C2 C3
0 0
-10 -5 0 5 10 0 5 10
X Y
(c) Each Rule's Output (d) Overall Input-Output Curve
10 10
Y
5 5
0 0
-10
Revised Oct.2017 -5 0 5 10 -10 CU
Dr. Khaled El-Metwally, -5 0 5 10 119
X X
Fuzzy Reasoning: MATLAB Demo
• >> ruleview mam21