You are on page 1of 61

‫بخوان به نام پروردگارت‬

‫که آموخت به انسان آنچه را نمی دانست‬

‫‪FUZZY LOGIC‬‬
‫‪LECTURE-1‬‬

‫کنترل فازی – جلسه اول و دوم‬


Course Information

Text/Reference Books 1
- Li-Xin Wang “A Course on Fuzzy System and Control”

‫ سيستم هاي فازي و كنترل فازي‬: :‫كتاب مرجع‬


‫ لي – وانگ‬: ‫نويسنده‬
‫ محمد تشنه لب‬: ‫مترجم‬

Text/Reference Books 2
- Timothy J. Ross “Fuzzy Logic with Engineering Application”

2
‫نحوه ارزيابي‬
‫تقرير‪ ،‬سمينار‪ ،‬تمرين و پروژه‪:‬‬
‫تهيه جزوه از مطالب كﻼس ‪ -‬فرمت ) ‪(.docx‬‬ ‫‪ ‬تقرير‪ :‬يادداشت برداري كﻼسي‬
‫‪ ‬سمينار‪ :‬گزارش مطالعاتي و ارائه شفاهي‬
‫فصلهاي مشخص شده كتاب كنترل فازي ) لي وانگ(‬
‫‪ ‬تمرين‪ :‬تمرينهاي دستي و كامپيوتري براي فهم مطالب درس‬
‫)يك مقاله براي گروهها جهت مطالعه مشخص خواهد شد(‬ ‫‪ ‬پروژه‪ :‬يك پروژه شبيه سازي كامپيوتري‬

‫امتحان پايان ترم‪:‬‬

‫‪University of Tehran - http://www.ut.ac.ir‬‬ ‫‪٣‬‬ ‫شبكه هاي عصبي مصنوعي‬


Why Fuzzy
• Based on intuition and judgment

• No need for a mathematical model

• Provides a smooth transition between members and


nonmembers

• Relatively simple, fast and adaptive

• Less sensitive to system fluctuations

• Can implement design objectives, difficult to express


mathematically, in linguistic or descriptive rules.
4
Why Fuzzy
• Complex, ill-defined processes difficult for description and
analysis by exact mathematical techniques
• Approximate and inexact nature of the real word;
vague concepts easily dealt with by humans in daily life
• Tolerance of imprecision in return for tractability, robustness,
and short computation time

Thus, we need other technique, as supplementary to


conventional quantitative methods, for manipulation of
vague and uncertain information, and to create systems that
are much closer in spirit to human thinking. Fuzzy logic is a
strong candidate for this purpose.

5
Fuzzy system applications
• Pattern recognition and classification
• Fuzzy clustering
• Image and speech processing
• Fuzzy systems for prediction
• Fuzzy control
• Monitoring
• Diagnosis
• Optimisation and decision making
• Group decision making
6
Some Interesting Applications
• Ride smoothness control

• Camcorder auto-focus and jiggle control

• Braking systems

• Copier quality control

• Rice cooker temperature control

• High performance drives

• Air-conditioning systems 7
Fuzzy System

8
Fuzzy inference systems

•a data base contains information about the membership functions of the


fuzzy sets used in fuzzy rules, the domains of the variables and kinds of
normalization.
•a rule base contains a number of fuzzy IF-THEN rules;
•a fuzzifier receives the current crisp values of the input variables and
transforms them into degrees of match with linguistic values;
•an inference unit performs the inference operation on the fuzzy rules;
a defuzzifier transforms the fuzzy results of the inference into a crisp
output by using a suitable transformation
Usually, the rule base and data base are jointly referred to as the
9
knowledge base
 Boolean/Crisp set A is a mapping for the elements of S to the
set {0, 1}, i.e., A: S  {0, 1}
 Characteristic function:
1 if x is an element of set A
  A (x ) =
0 if x is not an element of set A

• Fuzzy set F is a mapping for the elements of S to the interval


[0, 1], i.e., F: S  [0, 1]
• Characteristic function: 0  F(x)  1
• 1 means full membership, 0 means no membership and anything in
between, e.g., 0.5 is called graded membership

10
Definition of a fuzzy set
Classical set A in X is
a set of ordered pairs
A   x, I A  x  x  X ,
defined by indicator
function I A  x   0,1

Fuzzy set A in X is as
a set of ordered pairs
A   x,  A  x  x  X ,
defined by membership
function 0   A  x   1

11
One can define the crisp set “circles” as:

The fuzzy set “circles can be defined as:

12
Fuzzy Linguistic variables
Examples of fuzzy measures include:
close, heavy, light, big, small, smart, fast, slow, hot, cold,
Tall, Short, ....,
•Fuzzy sets and concepts are commonly used in natural language

John is tall
Dan is smart
Alex is happy
The class is hot

13
Crisp membership function
Crisp membership functions ( µ) are either one or zero.
• e.g. Numbers greater than 10.

A ={x | x>10}

μA( x )

10 14
Fuzzy membership function

The set, B, of numbers near to 2 can be represented by a


membership function:

15
Fuzzy membership function

16
Crips & Fuzzy Membership functions

17
Fuzzy Membership functions: S-function
 The S-function can be used to define fuzzy sets
 S(x, a, b, c) =
– 0 for x  a
– 2(x-a/c-a)2 for a  x  b
– 1 – 2(x-c/c-a)2 for b  x  c
– 1 for x  c

a b c

18
Fuzzy Membership functions: P-Function
 P(x, a, b) =
– S(x, b-a, b-a/2, b) for x  b
– 1 – S(x, b, b+a/2, a+b) for x  b

E.g., close (to a)


a

b-a b-a/2 a b+a/2 b+a 19


Linguistic Hedges
 Modifying the meaning of a fuzzy set using
hedges such as very, more or less, slightly, etc.
tall
 Very F = F2
 More or less F = F1/2
 etc.
More or less tall
Very tall

20
Fuzzy membership function

21
Fuzzy membership function

22
Fuzzy membership function

23
Fuzzy membership function

24
Fuzzy membership function

25
Fuzzy membership function

26
Fuzzy membership function

The list of MFs introduced here is by no means


exhaustive

Other specialized MFs can be created for specific


applications if necessary

Any type of continuous probability distribution


functions can be used as an MF

27
Fuzzy membership function ?

• Subjective evaluation: The shape of the functions


is defined by specialists
• Ad-hoc: choose a simple function that is suitable
to solve the problem
• Distributions, probabilities: information extracted
from measurements
• Adaptation: testing
• Automatic: algorithms used to define functions
from data
28
Properties of Fuzzy set

μA( x )
1

Height
Core
0
Boundary Boundary

Support

29
Properties of Fuzzy set

μA( x )
1

Height
Core
0
Boundary Boundary

Support

Core: Comprises those elements x of the Universe


Such that:  A ( x)  1
core( A)  {x  X |  A ( x)  1} 30
Properties of Fuzzy set

μA( x )
1

Height
Core
0
Boundary Boundary

Support

Support: Comprises those elements x of the Universe


Such that:  A ( x)  1
Support ( A)  {x  X |  A ( x)  1} 31
Properties of Fuzzy set

μA( x )
1

Height
Core
0
Boundary Boundary

Support

Boundary: Comprises those elements x of the


Universe Such that: 0   A ( x)  1
Boundary( A)  {x  X | 0   A ( x)  1} 32
Properties of Fuzzy set

Normal Subnormal
Properties of Fuzzy set

34
Properties of Fuzzy set

35
Fuzzy Variable

• A fuzzy variable is defined by the quadruple


V = { x, l, u, m}
• X is the variable symbolic name: temperature
• L is the set of labels: low, medium and high
• U is the universe of discourse
• M are the semantic rules that define the meaning of
each label in L (membership functions).

36
Fuzzy Variable Example

• X = Temperature
• L = {low, medium, high}
• U = {xX | -70o <= x <= +70o}
• M= low medium high
1.0

0.0

-70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70

37
Fuzzy Variable
• Completude: A variable is complete if for any x 
X there is a fuzzy set such as (x)>0
1.0
Complete

0.0
-70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70

1.0

Incomplete
0.0
-70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70

38
Fuzzy membership function

39
Fuzzy membership function

40
Example: Short, Medium height and Tall

Medium
1.0
Short Tall

5’ 5’6” 6’ 6’6” 7’

Note: Short(x) + Medium(x) + Tall(x)  1.


Someone who is 6’1” is simultaneously short, of medium height
and tall in various degrees which don’t add to 1.
41
Partition of Unity

• A fuzzy variable forms a partition of unity if for


each input value x
p

μ
i=1
Ai (x)1

• where p is the number of sets to which x belongs


• There is no rule to define the overlapping degree
between two neighbouring sets
• A rule of thumb is to use 25% to 50%

42
Partition of Unity

1,0

Partition of
0,5
Unity
0,0

-70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70

1,0
No Partition
0,5
of
Unity
0,0

-70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70

43
Partition of Unity cont

• Any complete fuzzy variable may be


transformed into a partition of unity using
the equation

μA (x)
μAˆ (x)= p
i
for i = 1,, p
μ
i
Aj (x)
j=1

44
Example: Light, Medium weight and
Heavy
Medium
1.0
Light Heavy

60 70 80 90 100
Weight (Kg)

45
 A. B ( x)  min(  A ( x) ,  B ( x))
 Example: Medium and Tall

Medium
1.0
Short Tall


Medium and Tall

5’ 5’6” 6’ 6’6” 7’

Note: No one is a full member of this set.


46
Fuzzy Logic Operations

Fuzzy union operation or fuzzy OR :

 A B ( x)  max( A ( x) ,  B ( x))
Fuzzy intersection operation or fuzzy AND

 A. B ( x)  min(  A ( x) ,  B ( x))
Complement operation

 A ( x)  1 -  A ( x) 47
 A. B ( x)  min(  A ( x) ,  B ( x))

48
 A. B ( x)  min(  A ( x) ,  B ( x))

49
 A B ( x)  max( A ( x) ,  B ( x))

50
 A B ( x)  max( A ( x) ,  B ( x))

51
 A B ( x)  max( A ( x) ,  B ( x))

Medium
1.0
Short Medium or Tall

Tall

5’ 5’6” 6’ 6’6” 7’

52
 A ( x)  1 -  A ( x)

 A (x)
 A (x)

 A (x)  A (x)

53
 A ( x)  1 -  A ( x)

Negation:  A ( x)  1 -  A ( x)

1.0
Not Tall Tall

5’ 5’6” 6’ 6’6” 7’

54
Fuzzy Logic Operations

55
Discrete fuzzy subset
A simple example of a discrete universe and a discrete fuzzy subset of
it, is:

X={-3, -2, -1, 0, 1, 2, 3, 4}

A= 0.6/-3 + 0.0/-2 + 0.3/-1 + 0.6/0 + 1.0/1 + 0.6/2 + 0.3/3 + 0.5/4

56
 A. B ( x)  min(  A ( x) ,  B ( x))
Let A and B be fuzzy subsets of the universe X={-3, -2, -1, 0, 1, 2, 3, 4}
A= 0.6/-3 + 0.0/-2 + 0.3/-1 + 0.6/0.0 + 1.0/1 + 0.6/2 + 0.3/3 + 0.5/4
B= 0.2/-3 + 0.6/-2 + 0.4/-1 + 0.6/0.0 + 0.5/1 + 0.4/2 + 0.5/3 + 0.3/4
AB = 0.2/-3 + 0.0/-2 + 0.3/-1 + 0.6/0.0 + 0.5/1 + 0.4/2 + 0.3/3 + 0.3/4

57
Possible operators for AND in fuzzy logic

 A (x)   B (x)
 A (x)   B (x)
 A ( x)   B ( x) -  A ( x)   B ( x)
max{0,  A ( x )   B ( x ) - 1}
 A ( x)   B ( x)
2 - [ A ( x )   B ( x ) -  A ( x )   B ( x )]
58
 A B ( x)  max( A ( x) ,  B ( x))

Let A and B be fuzzy subsets of the universe X={-3, -2, -1, 0, 1, 2, 3, 4}


A= 0.6/-3 + 0.0/-2 + 0.3/-1 + 0.6/0.0 + 1.0/1 + 0.6/2 + 0.3/3 + 0.5/4
B= 0.2/-3 + 0.6/-2 + 0.4/-1 + 0.6/0.0 + 0.5/1 + 0.4/2 + 0.5/3 + 0.3/4
AB = 0.6/-3 + 0.6/-2 + 0.4/-1 + 0.6/0.0 + 1.0/1 + 0.6/2 + 0.5/3 + 0.5/4

59
Possible operators for OR in fuzzy logic

 A (x)   B (x) -  A (x)   B (x)


 A ( x )   B ( x ) - 2 A ( x )   B ( x )
1 -  A ( x)   B ( x)

 A ( x)   B ( x)
1   A ( x )   B ( x )]

min{1,  A ( x )   B ( x )}
60
 A ( x)  1 -  A ( x)
Let A be fuzzy subset of the universe
X={-3, -2, -1, 0, 1, 2, 3, 4}

A = 0.6/-3 + 0.0/-2 + 0.3/-1 + 0.6/0.0 + 1.0/1 + 0.6/2 + 0.3/3 + 0.5/4

A = 0.4/-3 + 1.0/-2 + 0.7/-1 + 0.4/0.0 + 0.0/1 + 0.4/2 + 0.7/3 + 0.5/4

61

You might also like