SlideShare a Scribd company logo
1 of 75
1
• Other New Areas in AI:
– Particle Swarm Intelligence
Reasoning Learning Optimization
Fuzzy Logic
(FL)
Neural Networks
(NN)
Genetic Algorithm
(GA)
AI
2
Fuzzy Logic
• Fuzzy Logic was initiated in 1965 by Lotfy
Zadeh, professor for computer science at
the University of California in Berkeley.
• Fuzzy stated on the reasoning of facts.
• There is nothing in the world is definite,
there is nothing is absolute. All is a matter
of membership degree to a certain
reference (we must have reference)
3
Fuzzy Logic
• There are two main characteristics of
fuzzy systems that give them better
performance for specific applications:
– Fuzzy systems are suitable for uncertain or
approximate reasoning, especially for the
system with a mathematical model that is
difficult to derive.
– Fuzzy logic allows decision making with
estimated values under incomplete or
uncertain information.
4
Who is Who in Fuzzy Logic
• Lotfy Zadah:
– Established the concept of Fuzzy Logic.
• Mamdani:
– 1st one used fuzzy logic concepts for reasoning
in control (control of steam turbine).
• Sugeno:
– 1st one used fuzzy logic concepts in plane
control.
Crisp and fuzzy set
• Crisp Logic
• –A proposition can be true or false only.
• Bob is a student (true)
• Smoking is healthy (false)
• The degree of truth is 0 or 1.
• Fuzzy Logic
• The degree of truth is between 0 and 1.
• • William is young (0.3 truth)
• • Ariel is smart (0.9 truth)
5
Crisp set
• Crisp Sets
• Classical sets are called crisp sets
• either an element belongs to a set or not, i.e.,
• Member Function of crisp set
6
Crisp set
7
Fuzzy set
8
Membership Functions (MF’s)
• A fuzzy set is completely characterized by a membership
function.
• – a subjective measure.
• – not a probability measure
9
10
11
Venn Diagram
7
3
5
8
11
2
9
X AB
}7{ BA
12
13
Fuzzy Logic Versus Probability
• Fuzzy  Probability
• Fuzzy is said to measure “possibility” rather than
“probability”.
• Example :
– The probability that a fair die will show six is 1/6. This is a
crisp probability. All credible mathematicians will agree
on this exact number.
• While in Fuzzy Logic nothing is definite at all, it is
designed based on an expert vision which could
differ form another expert.
14
Correspondence between set theory and logic in the fuzzy case
like in the classical case
Where :
Is the Membership Function
Of the classical/fuzzy set A
in the variable x
)(xA
comparsion
15
16
MF formulation
17
18
Example
Good
A
V.G
B
Universe
Of Discourse
1
0
Fuzzy
Membership
Students grades can be classified with FL
))(,)((min)()()( BABABandAC xxxxx   
60% 70% 80% 90%
ExcellentPoor
19
Intersection
A B
Universe
Of Discourse
1
0
Fuzzy
Membership
Can be presented by min, product,…
C
))(,)((min)()()( BABABandAC xxxxx   
20
Union
A B
Universe
Of Discourse
1
0
Fuzzy
Membership
Can be presented by max, alg. sum,…
))(,)((max)()()( BABABorAC xxxxx   
C
21
Complement
A
Universe
Of Discourse
1
0
Fuzzy
Membership
)(1)()( AA'C xxx  
C=A’
22
Fuzzy logic Membership Function
A
Universe
Of Discourse
1
0
Fuzzy
Membership
Each x has a membership in A
Also, Each x has a membership in B
7.0)27(A x)(x
0.7
0.3
20 30 40
3.0)37(A x
0.1)30(A xB
23
Fuzzy logic Membership Function
0)27(B x
A
Universe
Of Discourse
1
0
Fuzzy
Membership
)(x
0.7
0.3
20 30 40
6.0)37(B x
0)30(B x
B
0.6
7.0)27(A x
3.0)37(A x
0.1)30(A x
0.66)max(0.3,0.))(,)((max)37( BABA  xxx 
0min(0.7,0)))(,)((min)27( BABA  xxx 
24
Fuzzy logic Kinds of operators
25
Fuzzy Logic in control
How to
Design
How to
use
? ?
26
How to design a Fuzzy Logic Controller?
• Basic Steps:
– Determine the linguistic variables & linguistic
values: (from the phenomena under study)
– Construct the rule-base:
(from logic, experience, templates)
– Tune parameters
( By trials or using any other tuning technique
like ANFIS depending on Neural Networks)
27
Fuzzy Linguistic Variables
• Linguistic Variable: The term (noun) used to
represent phenomena under study in a fuzzy sets.
• Linguistic value: is the value (adjective) which can
be assigned to the variable with degree of
membership.
• Examples:
System Linguistic Variable Linguistic Values
Furnace Temperature {cold, worm, hot }
School ExamGrade {fail, poor, good, very
good, excellent}
Car Speed {fast, medium, slow}
Basic Structure of Fuzzy Systems
28
Basic Structure of Fuzzy Systems
29
• Fuzzifier :Converts the crisp input to a linguistic variable
using the membership functions stored in the fuzzy
knowledge base.
• Defuzzifier : Converts the fuzzy output of the inference
engine to crisp using membership functions analogous to
the ones used by the fuzzifier .
• Fuzzy Knowledge Base that include Information storage for
• 1. Linguistic variables definitions.
• 2. Fuzzy rules.
Basic Operations in a Fuzzy Logic System
30
Types of inference
• 1.Mamadani Fuzzy Model
• 2.Sugeno Fuzzy Model
• 3.Tsukamoto Fuzzy Model
31
Fuzzy inference Mamadani
• One of the most commonly used fuzzy inference
technique is the so-called Mamdani method. In 1975,
Professor Ebrahim Mamdani of London University built
one of the first fuzzy systems to control a steam
engine and boiler combination. He applied a set of
fuzzy rules supplied by experienced human operators.
32
Fuzzy inference Mamadani
• The Mamdani-style fuzzy inference process is performed
in four steps:
• fuzzification of the input variables,
• rule evaluation;
• aggregation of the rule outputs, and finally
• defuzzification.
33
Mamadani FIS
• Rule base
• If X is A1 and Y is B1 then Z is C1
• If X is A2 and Y is B2 then Z is C2
34
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.
35
Sugeno types
• Zero order type
• First order type
36
First-Order Sugeno FIS
• Rule base
• If X is A1 and Y is B1 then Z = p1*x + q1*y + r1
• If X is A2 and Y is B2 then Z = p2*x + q2*y + r2
• Fuzzy reasoning
37
TSUKAMOTO FIS
• Rule base
• If X is A1 and Y is B1 then Z is C1
• If X is A2 and Y is B2 then Z is C2
38
39
Example 1.1: Restaurant
Fuzzy system in Restaurant
Service and Tips.
Service quality: is a matter of degrees.
Also Tips is a matter of degrees.
But there is some relation between this
input (the service) and that output (the
tips).
Represent the system
40
Ex: Service and Tips in Restaurant
If Antecedent then Consequent
Linguistic Variables
Linguistic Values
If Antecedent then Consequent
41
Ex: Service and Tips in Restaurant
If Antecedent then Consequent
Linguistic Variables
Linguistic Values
If Antecedent then Consequent
42
Example 1.2
Air Conditioning
• We have an air conditioned room, we want
to control the temperature of the room in
the range [0:60] degrees.
• Investigate this problem regarding classical
set theory and the fuzzy set theory.
43
Define Inputs / Outputs
Temp Fan_Sp
Temp
{hot,
worm,
Cold}
Fan_Sp
{high,
medium,
low}
If Temp is hot then Fan_Sp is high
If Antecedent then Consequent
Linguistic Variables
Linguistic Values
If Antecedent then Consequent
If Temp is worm then Fan_Sp is medium
If Temp is cold then Fan_Sp is low
44
Ex(1.1): Air Conditioning
Using Classical sets
Cold Worm Hot
Temperature
1
0
Crisp
Membership
20 40 60
This can be a part of an expert system
Linguistic Variable: Temp
Linguistic Value: Cold, Worm, Hot
Think:
What will happen when move among :
0, 10, 15,19.99 , 20, 20.01 ,40 degrees ???! Is this good ?!
45
Using Fuzzy Logic
Cold
Worm
Hot
Temperature
1
0
Fuzzy
Membership
20 40 60
This can be in a Fuzzy system
Linguistic Variable: Temp
Linguistic Value: Cold, Worm, Hot
Think:
This is a fuzzy inference systems replacing the actual
30
46
Output
low
medium
high
FanSpeed
rpm
1
0
Fuzzy
Membership
200 400 600
This can be in a Fuzzy system
Linguistic Variable: FanSpeed
Linguistic Value: low, medium, high
Think:
This is a fuzzy inference systems replacing the actual
300
47
How to use a Fuzzy Logic Controller?
e.g.: by Mamdani criteria (Max of min)
• For each rule: Calculate firing strength of inputs
– And -> min
– Or -> max
• For each rule: Map to degree of match of the Output
– Implication -> min
• Aggregation -> max
• Defuzzification-> centroid
– Now, The Output is mapped.
48
Fuzzy Inference System for
Multi-Input Single Output System
X1 is A1 & …
X1 is A2 & …
X1 is An & …
Y is B1
Y is B2
Y is Bn
Rule #1
Rule #2
Rule #n
Then
Then
Then
Antecedent Consequent
Aggregation
X
Fuzzy
Or
Crisp
Multi
Input
Y
Crisp
Defuzzification
Single
Output
Fuzzy Inference System
(FIS)
49
Assume Multi-Input Single Output
(MISO) with just two rules
A1 A21
Fuzzy
Controller
X
Y
Z
Output
Inputs
X
B1 B21
Y
C1 C21
Z
The Two rules
Rule #1 : If (x is A1) and (y is B1) then z is C1
Rule #2 : If (x is A2) and (y is B2) then z is C2
x y
50
A11
X
B11
Y
C11
Rule #1 : If (x is A1) and (y is B1) then z is C1
x y
A21
X
B21
Y
C21
x y
Rule #2 : If (x is A2) and (y is B2) then z is C2
&
&
Aggregation
Z
Z
With defuzzification
(centroid) We get z z
Z
51
How to use a Fuzzy Logic Controller?
e.g.: by Mamdani criteria (Max of min)
• For each rule: Calculate firing strength of inputs
– And  min
– Or  max
• For each rule: Map to degree of match of the Output
– Implication  min
• Aggregation  max
• Defuzzification  centroid
– Now, The Output is mapped. AGAIN !!!
52
Fuzzy Inference System for
Multi-Input Single Output System
X1 is A1 & …
X1 is A2 & …
X1 is An & …
Y is B1
Y is B2
Y is Bn
Rule #1
Rule #2
Rule #n
Then
Then
Then
Antecedent Consequent
Aggregation
X
Fuzzy
Or
Crisp
Multi
Input
Y
Crisp
Defuzzification
Single
Output
Fuzzy Inference System
(FIS)
53
54
Matlab Demo
55
Example2.1: Multi-Input Multi-Output
MIMO
Washing machine:
Based on clothes Load and Dirtiness the washing program
will set Cycle Time, Soap Amount, and Temperature.
Represent the system using Fuzzy logic
56
Fuzzy
controller
Load Cycle Time
Fuzzy
controller
inputs outputs
Soap amountDirtiness
Temperature
≡
Fuzzy
controller
Load
Soap amountDirtiness
Fuzzy
controller
Load
Dirtiness
Temperature
Fuzzy
controller
Load
Cycle Time
Dirtiness
MIMO
Equivalent
Number of
MISO
57
• MI (Multi-Input) :
1- Dirtiness:
range: [0 1]
MSF: Triangular (clean, dirty, very dirty)
2- load:
range: [0 1]
MSF: Triangular (light, medium, heavy)
• SO (single Output) :
1- Cycle Time:
range: [0 1]
MSF: Trapezoidal (short, medium , long)
58
• Rules:
Three rules
If (Dirtiness = clean) & (load =light) then CycleTime = short
If (Dirtiness = very dirty) or (load =heavy) then CycleTime = long
If (Dirtiness = dirty) then CycleTime = medium
59
Useful commands
readfis
evalfis
60
Matlab Demo
• g=readfis(‘wmachine.fis’);
• g=
• g.andMethod
• g.input
• g.input(1).name
• g.input(2).range
• g.input(1).mf
• g.rule
• Y=evalfis([0.3;0.9],g)
Air condition application
• Component
• Arduino uno
• 2 potentiometer
• Led as output
• Fuzzy logic programming (fis) using Matlab
• Arduino code using specific website
61
62
Scaling Factors
• The scaling factors are the main parameters used to tune
fuzzy logic controller (FLC).
• Changing the scaling factors changes the normalized
universe of discourse.
• For example:
– High value of Ke (input gain) result in low steady state error and rise time
but large overshoot.
– Low value of Kdu (output gain) increase the rise time and integral square
error.
• Tune will be around 80%-120% of the initial values where:
– Ke : input error gain
– Kde : input rate of error gain
– Kdu : output rate of control signal gain
– .
u
.e
Fuzzy
controllere
.
ke
kde
Plantkdu 1/s
u
PI-Like
Fuzzy Controller
63
How to design a Fuzzy Logic Controller?
• Basic Steps:
– Determine the linguistic variables & linguistic
values: (from the phenomena under study)
– Construct the rule-base:
(from logic, experience, templates)
– Tune parameters
( By trials or using any other tuning technique
like ANFIS depending on Neural Networks)
64
Tuning:
==========
1- start with the minimum number of MSFs you expect
2- Adapt ranges to map the phenomena correctly
3- write the minimum number of rule you expect
4- if not enough, write all the rules expected
5- if still not enough change the MSFs types
6- if still not enough increase number of MSFs
7- Write the rules again (consider weights)
8- change the scaling factors
9- change the methods of implication, aggregation, and
defuzzification.
Questions?
=========
is there steady state error? ess
is there overshoot? O.S
is there long delay? (is the rise time accepted or not) tr
65
Settling time: ts
2% criteria
5% criteria
Transient Response
Steady state error: ess
Delay time: td
Rise time: tr
Peak time: tp
Maximum overshoot: Mp
Settling time: ts
Time constant: T
n
s Tt

4
4 
n
s Tt

3
3  td ts
Mp
0.5
tptr
Maximum overshoot:
2% criteria or
5% criteria














2
1
eM p
Time constant:
n
T

1

2nd order system
66
PI- like Fuzzy Control
.
time
yref
Desired
response
dt
dy
dt
de
e
yye ref



y
t
e
Fuzzy
controllere
. u
.
1/s
u
67
Divide error interval to zones
.
time
yref
Desired
response
N
z
PS
P
NS
y
t
dt
dy
dt
de
e
yye ref



u
.e
Fuzzy
controllere
. 1/s
u
68
Divide rate of error (slope) to zones
.
time
yref
Desired
response
N z
z
NS PPS
y
t
PS NS
z
dt
dy
dt
de
e
yye ref



For example:
N: < - 60
NS: -60 : -20
Z: -20 : 20
PS: 20 : 60
P: > 60
69
PI-like Fuzzy controller
Control action ( u
.
):
N: Negative
NS : Negative Small
Z : Zero
PS : Positive Small
CF: Positive
Error rate ( e
.
)
N NS Z PS P
Error(e)
N N N N NS Z
NS N N NS Z PS
Z N NS Z PS P
PS NS Z PS P P
P Z PS P P P
70
TSK model
Takagi, Sugeno, Kang
. Antecedent Consequent
V_low
low
V_high
x
1
Fuzzy
Membership
-1 10
y
1
Fuzzy
Membership
y1 y3y2
α2
=0.8
α1
=0.4
α3
=0.2
...
...
321
332211




 yyy
y
The Three rules
If (x is low) then (y1 = 2*x+5)
If (x is high) then (y2 = 1*x+3)
If (x is v_high) then (y3 = 8)
Note: as x changes
this will affect y’s and also α’s
high
71
Example:
function approximation
• We want to approximate this
function in the range [1 3] using
fuzzy TSK model with five MSFs.
y = x2
y
x
72
Example:
function approximation
• We need five equations one for each
subrange.
Solution:
y = x2
y
x
)(|
:
ixi xx
dx
dy
yy
x
dx
dy
y
x
y
dx
dy
Taylor
i





x y=x2
1 1 2
1.5 2.25 3
2 4 4
2.5 6.25 5
3 9 6
x
dx
dy
2 )(| ixi xx
dx
dy
yy i

12
)1(21


xy
xy
25.23
)5.1(325.2


xy
xy
44
)2(44


xy
xy
25.65
)5.2(525.6


xy
xy
96
)3(69


xy
xy
73
.
Antecedent: x Consequent: y
x
1
Fuzzy
Membership
1 2.50
y
1
Fuzzy
Membership
y1 y5y2
The five rules
If (x is one) then (y1 = 2*x - 1)
If (x is 1hf) then (y2 = 3*x - 2.25)
If (x is two) then (y3 = 4*x - 4)
If (x is 2hf) then (y4 = 5*x - 6.25)
If (x is three) then (y5 = 6*x - 9)
one
1.5 2 3
1hf two 2hf three
y3 y4
74
Matlab Demo
75
References
1. J.-S. Roger Jang, Ned Gulley “Artificial Intelligence -
Fuzzy Logic Toolbox, Matlab”, Mathwotks,1997.
2. R. Full´er “Neural Fuzzy Systems” Abo, 1995.
3. ITI ,“Nine Month Program Training Kit”, 2007.
4. H.Larsen “Fundamentals of fuzzy sets and fuzzy logic”
Aalborg University, 2005.
5. Prof. A. Hambaba” Networked–Intelligent Software
Agents & Agents” San Jose state, 2002.
6. Prof. P. Smyth, “Introduction to Artificial Intelligence”,
UCIrvine, 2007.
7. R. J. Marks “Introduction to Fuzzy Inference”, Baylor
University
8. http://en.wikipedia.org/

More Related Content

What's hot (20)

Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logic
 
Back propagation
Back propagationBack propagation
Back propagation
 
Chapter 5 - Fuzzy Logic
Chapter 5 - Fuzzy LogicChapter 5 - Fuzzy Logic
Chapter 5 - Fuzzy Logic
 
Fuzzy logic ppt
Fuzzy logic pptFuzzy logic ppt
Fuzzy logic ppt
 
Application of fuzzy logic
Application of fuzzy logicApplication of fuzzy logic
Application of fuzzy logic
 
AI - Fuzzy Logic Systems
AI - Fuzzy Logic SystemsAI - Fuzzy Logic Systems
AI - Fuzzy Logic Systems
 
Fuzzy logic member functions
Fuzzy logic member functionsFuzzy logic member functions
Fuzzy logic member functions
 
FUZZY LOGIC
FUZZY LOGIC FUZZY LOGIC
FUZZY LOGIC
 
Fuzzy Sets Introduction With Example
Fuzzy Sets Introduction With ExampleFuzzy Sets Introduction With Example
Fuzzy Sets Introduction With Example
 
Firefly algorithm
Firefly algorithmFirefly algorithm
Firefly algorithm
 
Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logic
 
Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logic
 
Defuzzification
DefuzzificationDefuzzification
Defuzzification
 
ANFIS
ANFISANFIS
ANFIS
 
Sorting network
Sorting networkSorting network
Sorting network
 
On fuzzy concepts in engineering ppt. ncce
On fuzzy concepts in engineering ppt. ncceOn fuzzy concepts in engineering ppt. ncce
On fuzzy concepts in engineering ppt. ncce
 
Fuzzy Logic
Fuzzy LogicFuzzy Logic
Fuzzy Logic
 
Fuzzy rules and fuzzy reasoning
Fuzzy rules and fuzzy reasoningFuzzy rules and fuzzy reasoning
Fuzzy rules and fuzzy reasoning
 
Forward Backward Chaining
Forward Backward ChainingForward Backward Chaining
Forward Backward Chaining
 
Fuzzy logic and its applications
Fuzzy logic and its applicationsFuzzy logic and its applications
Fuzzy logic and its applications
 

Similar to Fuzzy logic

Fuzzy Logic Controller.pptx
Fuzzy Logic Controller.pptxFuzzy Logic Controller.pptx
Fuzzy Logic Controller.pptxMahuaPal6
 
Lec 5 uncertainty
Lec 5 uncertaintyLec 5 uncertainty
Lec 5 uncertaintyEyob Sisay
 
Fuzzy Logic Seminar with Implementation
Fuzzy Logic Seminar with ImplementationFuzzy Logic Seminar with Implementation
Fuzzy Logic Seminar with ImplementationBhaumik Parmar
 
Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logicAdPatel5
 
Fuzzy logic in approximate Reasoning
Fuzzy logic in approximate ReasoningFuzzy logic in approximate Reasoning
Fuzzy logic in approximate ReasoningHoàng Đức
 
Fuzzy logic - Approximate reasoning
Fuzzy logic - Approximate reasoningFuzzy logic - Approximate reasoning
Fuzzy logic - Approximate reasoningDr. C.V. Suresh Babu
 
Fuzzy logic systems
Fuzzy logic systemsFuzzy logic systems
Fuzzy logic systemsPham Tung
 
Fuzzy logicintro by
Fuzzy logicintro by Fuzzy logicintro by
Fuzzy logicintro by Waseem Abbas
 
Deep learning Unit1 BasicsAllllllll.pptx
Deep learning Unit1 BasicsAllllllll.pptxDeep learning Unit1 BasicsAllllllll.pptx
Deep learning Unit1 BasicsAllllllll.pptxFreefireGarena30
 
Propositional logic(part 2)
Propositional logic(part 2)Propositional logic(part 2)
Propositional logic(part 2)SURBHI SAROHA
 
Fuzzy modelling using sciFLT
Fuzzy modelling using sciFLTFuzzy modelling using sciFLT
Fuzzy modelling using sciFLTUmang Shukla
 
Neural machine translation by jointly learning to align and translate.pptx
Neural machine translation by jointly learning to align and translate.pptxNeural machine translation by jointly learning to align and translate.pptx
Neural machine translation by jointly learning to align and translate.pptxssuser2624f71
 
01 Notes Introduction Analysis of Algorithms Notes
01 Notes Introduction Analysis of Algorithms Notes01 Notes Introduction Analysis of Algorithms Notes
01 Notes Introduction Analysis of Algorithms NotesAndres Mendez-Vazquez
 
SoftComputing.pdf
SoftComputing.pdfSoftComputing.pdf
SoftComputing.pdfktosri
 

Similar to Fuzzy logic (20)

Fuzzy Logic Controller.pptx
Fuzzy Logic Controller.pptxFuzzy Logic Controller.pptx
Fuzzy Logic Controller.pptx
 
Lec 5 uncertainty
Lec 5 uncertaintyLec 5 uncertainty
Lec 5 uncertainty
 
Fuzzy Logic Seminar with Implementation
Fuzzy Logic Seminar with ImplementationFuzzy Logic Seminar with Implementation
Fuzzy Logic Seminar with Implementation
 
Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logic
 
Fuzzylogic
Fuzzylogic Fuzzylogic
Fuzzylogic
 
Fuzzy logic in approximate Reasoning
Fuzzy logic in approximate ReasoningFuzzy logic in approximate Reasoning
Fuzzy logic in approximate Reasoning
 
Fuzzy logic - Approximate reasoning
Fuzzy logic - Approximate reasoningFuzzy logic - Approximate reasoning
Fuzzy logic - Approximate reasoning
 
Fuzzy logic systems
Fuzzy logic systemsFuzzy logic systems
Fuzzy logic systems
 
Fuzzy logicintro by
Fuzzy logicintro by Fuzzy logicintro by
Fuzzy logicintro by
 
Fuzzy and nn
Fuzzy and nnFuzzy and nn
Fuzzy and nn
 
Deep learning Unit1 BasicsAllllllll.pptx
Deep learning Unit1 BasicsAllllllll.pptxDeep learning Unit1 BasicsAllllllll.pptx
Deep learning Unit1 BasicsAllllllll.pptx
 
Introduction to fuzzy logic
Introduction to fuzzy logicIntroduction to fuzzy logic
Introduction to fuzzy logic
 
Ch03 fls
Ch03 flsCh03 fls
Ch03 fls
 
Propositional logic(part 2)
Propositional logic(part 2)Propositional logic(part 2)
Propositional logic(part 2)
 
Fuzzy modelling using sciFLT
Fuzzy modelling using sciFLTFuzzy modelling using sciFLT
Fuzzy modelling using sciFLT
 
Neural machine translation by jointly learning to align and translate.pptx
Neural machine translation by jointly learning to align and translate.pptxNeural machine translation by jointly learning to align and translate.pptx
Neural machine translation by jointly learning to align and translate.pptx
 
Neural networks
Neural networksNeural networks
Neural networks
 
01 Notes Introduction Analysis of Algorithms Notes
01 Notes Introduction Analysis of Algorithms Notes01 Notes Introduction Analysis of Algorithms Notes
01 Notes Introduction Analysis of Algorithms Notes
 
SoftComputing.pdf
SoftComputing.pdfSoftComputing.pdf
SoftComputing.pdf
 
Greedy method
Greedy methodGreedy method
Greedy method
 

More from Mahmoud Hussein

More from Mahmoud Hussein (20)

07 modelling.electric.motors
07 modelling.electric.motors07 modelling.electric.motors
07 modelling.electric.motors
 
Dc dc converter
Dc dc converterDc dc converter
Dc dc converter
 
08 pid.controller
08 pid.controller08 pid.controller
08 pid.controller
 
06 control.systems
06 control.systems06 control.systems
06 control.systems
 
05 tuning.pid.controllers
05 tuning.pid.controllers05 tuning.pid.controllers
05 tuning.pid.controllers
 
02 physical.system.modelling mechanical.systems.
02 physical.system.modelling mechanical.systems.02 physical.system.modelling mechanical.systems.
02 physical.system.modelling mechanical.systems.
 
03 dynamic.system.
03 dynamic.system.03 dynamic.system.
03 dynamic.system.
 
Lecture 02 laplace transformation
Lecture 02 laplace transformationLecture 02 laplace transformation
Lecture 02 laplace transformation
 
Mbd2
Mbd2Mbd2
Mbd2
 
Model based design-Hardware in loop-software in loop
Model based design-Hardware in loop-software in loopModel based design-Hardware in loop-software in loop
Model based design-Hardware in loop-software in loop
 
Ac drive basics
Ac drive basicsAc drive basics
Ac drive basics
 
Velocity kinematics
Velocity kinematicsVelocity kinematics
Velocity kinematics
 
MPI Communication
MPI CommunicationMPI Communication
MPI Communication
 
ERROR
ERRORERROR
ERROR
 
Analogue Module
Analogue ModuleAnalogue Module
Analogue Module
 
Function Block & Organization Block
Function Block & Organization BlockFunction Block & Organization Block
Function Block & Organization Block
 
Data Block
Data BlockData Block
Data Block
 
Declaration Table
Declaration TableDeclaration Table
Declaration Table
 
Math operation
Math operationMath operation
Math operation
 
Industrial communication
Industrial communicationIndustrial communication
Industrial communication
 

Recently uploaded

Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxPurva Nikam
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 

Recently uploaded (20)

Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptx
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 

Fuzzy logic

  • 1. 1 • Other New Areas in AI: – Particle Swarm Intelligence Reasoning Learning Optimization Fuzzy Logic (FL) Neural Networks (NN) Genetic Algorithm (GA) AI
  • 2. 2 Fuzzy Logic • Fuzzy Logic was initiated in 1965 by Lotfy Zadeh, professor for computer science at the University of California in Berkeley. • Fuzzy stated on the reasoning of facts. • There is nothing in the world is definite, there is nothing is absolute. All is a matter of membership degree to a certain reference (we must have reference)
  • 3. 3 Fuzzy Logic • There are two main characteristics of fuzzy systems that give them better performance for specific applications: – Fuzzy systems are suitable for uncertain or approximate reasoning, especially for the system with a mathematical model that is difficult to derive. – Fuzzy logic allows decision making with estimated values under incomplete or uncertain information.
  • 4. 4 Who is Who in Fuzzy Logic • Lotfy Zadah: – Established the concept of Fuzzy Logic. • Mamdani: – 1st one used fuzzy logic concepts for reasoning in control (control of steam turbine). • Sugeno: – 1st one used fuzzy logic concepts in plane control.
  • 5. Crisp and fuzzy set • Crisp Logic • –A proposition can be true or false only. • Bob is a student (true) • Smoking is healthy (false) • The degree of truth is 0 or 1. • Fuzzy Logic • The degree of truth is between 0 and 1. • • William is young (0.3 truth) • • Ariel is smart (0.9 truth) 5
  • 6. Crisp set • Crisp Sets • Classical sets are called crisp sets • either an element belongs to a set or not, i.e., • Member Function of crisp set 6
  • 9. Membership Functions (MF’s) • A fuzzy set is completely characterized by a membership function. • – a subjective measure. • – not a probability measure 9
  • 10. 10
  • 12. 12
  • 13. 13 Fuzzy Logic Versus Probability • Fuzzy  Probability • Fuzzy is said to measure “possibility” rather than “probability”. • Example : – The probability that a fair die will show six is 1/6. This is a crisp probability. All credible mathematicians will agree on this exact number. • While in Fuzzy Logic nothing is definite at all, it is designed based on an expert vision which could differ form another expert.
  • 14. 14 Correspondence between set theory and logic in the fuzzy case like in the classical case Where : Is the Membership Function Of the classical/fuzzy set A in the variable x )(xA
  • 16. 16
  • 18. 18 Example Good A V.G B Universe Of Discourse 1 0 Fuzzy Membership Students grades can be classified with FL ))(,)((min)()()( BABABandAC xxxxx    60% 70% 80% 90% ExcellentPoor
  • 19. 19 Intersection A B Universe Of Discourse 1 0 Fuzzy Membership Can be presented by min, product,… C ))(,)((min)()()( BABABandAC xxxxx   
  • 20. 20 Union A B Universe Of Discourse 1 0 Fuzzy Membership Can be presented by max, alg. sum,… ))(,)((max)()()( BABABorAC xxxxx    C
  • 22. 22 Fuzzy logic Membership Function A Universe Of Discourse 1 0 Fuzzy Membership Each x has a membership in A Also, Each x has a membership in B 7.0)27(A x)(x 0.7 0.3 20 30 40 3.0)37(A x 0.1)30(A xB
  • 23. 23 Fuzzy logic Membership Function 0)27(B x A Universe Of Discourse 1 0 Fuzzy Membership )(x 0.7 0.3 20 30 40 6.0)37(B x 0)30(B x B 0.6 7.0)27(A x 3.0)37(A x 0.1)30(A x 0.66)max(0.3,0.))(,)((max)37( BABA  xxx  0min(0.7,0)))(,)((min)27( BABA  xxx 
  • 24. 24 Fuzzy logic Kinds of operators
  • 25. 25 Fuzzy Logic in control How to Design How to use ? ?
  • 26. 26 How to design a Fuzzy Logic Controller? • Basic Steps: – Determine the linguistic variables & linguistic values: (from the phenomena under study) – Construct the rule-base: (from logic, experience, templates) – Tune parameters ( By trials or using any other tuning technique like ANFIS depending on Neural Networks)
  • 27. 27 Fuzzy Linguistic Variables • Linguistic Variable: The term (noun) used to represent phenomena under study in a fuzzy sets. • Linguistic value: is the value (adjective) which can be assigned to the variable with degree of membership. • Examples: System Linguistic Variable Linguistic Values Furnace Temperature {cold, worm, hot } School ExamGrade {fail, poor, good, very good, excellent} Car Speed {fast, medium, slow}
  • 28. Basic Structure of Fuzzy Systems 28
  • 29. Basic Structure of Fuzzy Systems 29 • Fuzzifier :Converts the crisp input to a linguistic variable using the membership functions stored in the fuzzy knowledge base. • Defuzzifier : Converts the fuzzy output of the inference engine to crisp using membership functions analogous to the ones used by the fuzzifier . • Fuzzy Knowledge Base that include Information storage for • 1. Linguistic variables definitions. • 2. Fuzzy rules.
  • 30. Basic Operations in a Fuzzy Logic System 30
  • 31. Types of inference • 1.Mamadani Fuzzy Model • 2.Sugeno Fuzzy Model • 3.Tsukamoto Fuzzy Model 31
  • 32. Fuzzy inference Mamadani • One of the most commonly used fuzzy inference technique is the so-called Mamdani method. In 1975, Professor Ebrahim Mamdani of London University built one of the first fuzzy systems to control a steam engine and boiler combination. He applied a set of fuzzy rules supplied by experienced human operators. 32
  • 33. Fuzzy inference Mamadani • The Mamdani-style fuzzy inference process is performed in four steps: • fuzzification of the input variables, • rule evaluation; • aggregation of the rule outputs, and finally • defuzzification. 33
  • 34. Mamadani FIS • Rule base • If X is A1 and Y is B1 then Z is C1 • If X is A2 and Y is B2 then Z is C2 34
  • 35. 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. 35
  • 36. Sugeno types • Zero order type • First order type 36
  • 37. First-Order Sugeno FIS • Rule base • If X is A1 and Y is B1 then Z = p1*x + q1*y + r1 • If X is A2 and Y is B2 then Z = p2*x + q2*y + r2 • Fuzzy reasoning 37
  • 38. TSUKAMOTO FIS • Rule base • If X is A1 and Y is B1 then Z is C1 • If X is A2 and Y is B2 then Z is C2 38
  • 39. 39 Example 1.1: Restaurant Fuzzy system in Restaurant Service and Tips. Service quality: is a matter of degrees. Also Tips is a matter of degrees. But there is some relation between this input (the service) and that output (the tips). Represent the system
  • 40. 40 Ex: Service and Tips in Restaurant If Antecedent then Consequent Linguistic Variables Linguistic Values If Antecedent then Consequent
  • 41. 41 Ex: Service and Tips in Restaurant If Antecedent then Consequent Linguistic Variables Linguistic Values If Antecedent then Consequent
  • 42. 42 Example 1.2 Air Conditioning • We have an air conditioned room, we want to control the temperature of the room in the range [0:60] degrees. • Investigate this problem regarding classical set theory and the fuzzy set theory.
  • 43. 43 Define Inputs / Outputs Temp Fan_Sp Temp {hot, worm, Cold} Fan_Sp {high, medium, low} If Temp is hot then Fan_Sp is high If Antecedent then Consequent Linguistic Variables Linguistic Values If Antecedent then Consequent If Temp is worm then Fan_Sp is medium If Temp is cold then Fan_Sp is low
  • 44. 44 Ex(1.1): Air Conditioning Using Classical sets Cold Worm Hot Temperature 1 0 Crisp Membership 20 40 60 This can be a part of an expert system Linguistic Variable: Temp Linguistic Value: Cold, Worm, Hot Think: What will happen when move among : 0, 10, 15,19.99 , 20, 20.01 ,40 degrees ???! Is this good ?!
  • 45. 45 Using Fuzzy Logic Cold Worm Hot Temperature 1 0 Fuzzy Membership 20 40 60 This can be in a Fuzzy system Linguistic Variable: Temp Linguistic Value: Cold, Worm, Hot Think: This is a fuzzy inference systems replacing the actual 30
  • 46. 46 Output low medium high FanSpeed rpm 1 0 Fuzzy Membership 200 400 600 This can be in a Fuzzy system Linguistic Variable: FanSpeed Linguistic Value: low, medium, high Think: This is a fuzzy inference systems replacing the actual 300
  • 47. 47 How to use a Fuzzy Logic Controller? e.g.: by Mamdani criteria (Max of min) • For each rule: Calculate firing strength of inputs – And -> min – Or -> max • For each rule: Map to degree of match of the Output – Implication -> min • Aggregation -> max • Defuzzification-> centroid – Now, The Output is mapped.
  • 48. 48 Fuzzy Inference System for Multi-Input Single Output System X1 is A1 & … X1 is A2 & … X1 is An & … Y is B1 Y is B2 Y is Bn Rule #1 Rule #2 Rule #n Then Then Then Antecedent Consequent Aggregation X Fuzzy Or Crisp Multi Input Y Crisp Defuzzification Single Output Fuzzy Inference System (FIS)
  • 49. 49 Assume Multi-Input Single Output (MISO) with just two rules A1 A21 Fuzzy Controller X Y Z Output Inputs X B1 B21 Y C1 C21 Z The Two rules Rule #1 : If (x is A1) and (y is B1) then z is C1 Rule #2 : If (x is A2) and (y is B2) then z is C2 x y
  • 50. 50 A11 X B11 Y C11 Rule #1 : If (x is A1) and (y is B1) then z is C1 x y A21 X B21 Y C21 x y Rule #2 : If (x is A2) and (y is B2) then z is C2 & & Aggregation Z Z With defuzzification (centroid) We get z z Z
  • 51. 51 How to use a Fuzzy Logic Controller? e.g.: by Mamdani criteria (Max of min) • For each rule: Calculate firing strength of inputs – And  min – Or  max • For each rule: Map to degree of match of the Output – Implication  min • Aggregation  max • Defuzzification  centroid – Now, The Output is mapped. AGAIN !!!
  • 52. 52 Fuzzy Inference System for Multi-Input Single Output System X1 is A1 & … X1 is A2 & … X1 is An & … Y is B1 Y is B2 Y is Bn Rule #1 Rule #2 Rule #n Then Then Then Antecedent Consequent Aggregation X Fuzzy Or Crisp Multi Input Y Crisp Defuzzification Single Output Fuzzy Inference System (FIS)
  • 53. 53
  • 55. 55 Example2.1: Multi-Input Multi-Output MIMO Washing machine: Based on clothes Load and Dirtiness the washing program will set Cycle Time, Soap Amount, and Temperature. Represent the system using Fuzzy logic
  • 56. 56 Fuzzy controller Load Cycle Time Fuzzy controller inputs outputs Soap amountDirtiness Temperature ≡ Fuzzy controller Load Soap amountDirtiness Fuzzy controller Load Dirtiness Temperature Fuzzy controller Load Cycle Time Dirtiness MIMO Equivalent Number of MISO
  • 57. 57 • MI (Multi-Input) : 1- Dirtiness: range: [0 1] MSF: Triangular (clean, dirty, very dirty) 2- load: range: [0 1] MSF: Triangular (light, medium, heavy) • SO (single Output) : 1- Cycle Time: range: [0 1] MSF: Trapezoidal (short, medium , long)
  • 58. 58 • Rules: Three rules If (Dirtiness = clean) & (load =light) then CycleTime = short If (Dirtiness = very dirty) or (load =heavy) then CycleTime = long If (Dirtiness = dirty) then CycleTime = medium
  • 60. 60 Matlab Demo • g=readfis(‘wmachine.fis’); • g= • g.andMethod • g.input • g.input(1).name • g.input(2).range • g.input(1).mf • g.rule • Y=evalfis([0.3;0.9],g)
  • 61. Air condition application • Component • Arduino uno • 2 potentiometer • Led as output • Fuzzy logic programming (fis) using Matlab • Arduino code using specific website 61
  • 62. 62 Scaling Factors • The scaling factors are the main parameters used to tune fuzzy logic controller (FLC). • Changing the scaling factors changes the normalized universe of discourse. • For example: – High value of Ke (input gain) result in low steady state error and rise time but large overshoot. – Low value of Kdu (output gain) increase the rise time and integral square error. • Tune will be around 80%-120% of the initial values where: – Ke : input error gain – Kde : input rate of error gain – Kdu : output rate of control signal gain – . u .e Fuzzy controllere . ke kde Plantkdu 1/s u PI-Like Fuzzy Controller
  • 63. 63 How to design a Fuzzy Logic Controller? • Basic Steps: – Determine the linguistic variables & linguistic values: (from the phenomena under study) – Construct the rule-base: (from logic, experience, templates) – Tune parameters ( By trials or using any other tuning technique like ANFIS depending on Neural Networks)
  • 64. 64 Tuning: ========== 1- start with the minimum number of MSFs you expect 2- Adapt ranges to map the phenomena correctly 3- write the minimum number of rule you expect 4- if not enough, write all the rules expected 5- if still not enough change the MSFs types 6- if still not enough increase number of MSFs 7- Write the rules again (consider weights) 8- change the scaling factors 9- change the methods of implication, aggregation, and defuzzification. Questions? ========= is there steady state error? ess is there overshoot? O.S is there long delay? (is the rise time accepted or not) tr
  • 65. 65 Settling time: ts 2% criteria 5% criteria Transient Response Steady state error: ess Delay time: td Rise time: tr Peak time: tp Maximum overshoot: Mp Settling time: ts Time constant: T n s Tt  4 4  n s Tt  3 3  td ts Mp 0.5 tptr Maximum overshoot: 2% criteria or 5% criteria               2 1 eM p Time constant: n T  1  2nd order system
  • 66. 66 PI- like Fuzzy Control . time yref Desired response dt dy dt de e yye ref    y t e Fuzzy controllere . u . 1/s u
  • 67. 67 Divide error interval to zones . time yref Desired response N z PS P NS y t dt dy dt de e yye ref    u .e Fuzzy controllere . 1/s u
  • 68. 68 Divide rate of error (slope) to zones . time yref Desired response N z z NS PPS y t PS NS z dt dy dt de e yye ref    For example: N: < - 60 NS: -60 : -20 Z: -20 : 20 PS: 20 : 60 P: > 60
  • 69. 69 PI-like Fuzzy controller Control action ( u . ): N: Negative NS : Negative Small Z : Zero PS : Positive Small CF: Positive Error rate ( e . ) N NS Z PS P Error(e) N N N N NS Z NS N N NS Z PS Z N NS Z PS P PS NS Z PS P P P Z PS P P P
  • 70. 70 TSK model Takagi, Sugeno, Kang . Antecedent Consequent V_low low V_high x 1 Fuzzy Membership -1 10 y 1 Fuzzy Membership y1 y3y2 α2 =0.8 α1 =0.4 α3 =0.2 ... ... 321 332211      yyy y The Three rules If (x is low) then (y1 = 2*x+5) If (x is high) then (y2 = 1*x+3) If (x is v_high) then (y3 = 8) Note: as x changes this will affect y’s and also α’s high
  • 71. 71 Example: function approximation • We want to approximate this function in the range [1 3] using fuzzy TSK model with five MSFs. y = x2 y x
  • 72. 72 Example: function approximation • We need five equations one for each subrange. Solution: y = x2 y x )(| : ixi xx dx dy yy x dx dy y x y dx dy Taylor i      x y=x2 1 1 2 1.5 2.25 3 2 4 4 2.5 6.25 5 3 9 6 x dx dy 2 )(| ixi xx dx dy yy i  12 )1(21   xy xy 25.23 )5.1(325.2   xy xy 44 )2(44   xy xy 25.65 )5.2(525.6   xy xy 96 )3(69   xy xy
  • 73. 73 . Antecedent: x Consequent: y x 1 Fuzzy Membership 1 2.50 y 1 Fuzzy Membership y1 y5y2 The five rules If (x is one) then (y1 = 2*x - 1) If (x is 1hf) then (y2 = 3*x - 2.25) If (x is two) then (y3 = 4*x - 4) If (x is 2hf) then (y4 = 5*x - 6.25) If (x is three) then (y5 = 6*x - 9) one 1.5 2 3 1hf two 2hf three y3 y4
  • 75. 75 References 1. J.-S. Roger Jang, Ned Gulley “Artificial Intelligence - Fuzzy Logic Toolbox, Matlab”, Mathwotks,1997. 2. R. Full´er “Neural Fuzzy Systems” Abo, 1995. 3. ITI ,“Nine Month Program Training Kit”, 2007. 4. H.Larsen “Fundamentals of fuzzy sets and fuzzy logic” Aalborg University, 2005. 5. Prof. A. Hambaba” Networked–Intelligent Software Agents & Agents” San Jose state, 2002. 6. Prof. P. Smyth, “Introduction to Artificial Intelligence”, UCIrvine, 2007. 7. R. J. Marks “Introduction to Fuzzy Inference”, Baylor University 8. http://en.wikipedia.org/