Fuzzy Logic Examples
Fuzzy Logic Examples
Fuzzy Logic Examples
EPMn 643
Module 3: Fuzzy Logic Examples &
Tools
Define the Young and the Old fuzzy sets then induce the Middle
Age fuzzy set using proper fuzzy operators.
Feedback
Mapping
Process
Fuzzy
Crisp Inputs
FLC
Rule Crisp Outputs
Base
Knowledge Base
Feedback
e
FLC U
De
ZERO
NB NM NS PS PM PB
1
-Ve
0 +Ve
e
Oct 2017 Dr. Khaled El-Metwally, CU 17
How Fuzzification is done ?
NB NM NS ZZ PS PM PB
0.6
0.4 1
De
Oct 2017 Dr. Khaled El-Metwally, CU 18
Defining FLPSS Memberships
NB NM NS ZZ PS PM PB
e
NB NM NS ZZ PS PM PB
De
NB NM NS ZZ PS PM PB
IF e is NB AND De is NB THEN U is PB
Described by Described by
7 Fuzzy Subsets 7 Fuzzy Subsets
IF Dw is NB AND De is NB THEN U is PB
e = 0.6 PS U=?
e = 1 PS
De = 0.2 NM
F U = 0.2 PB
U = 0 PB
De = 0 NM
NB NM NS ZZ PS PM PB
e
NB NM NS ZZ PS PM PB
De
Oct 2017 Dr. Khaled El-Metwally, CU 23
Rules Inference
0.6 0.4
De NB NM NS ZZ PS PM PB
0.6 PS 0.4 PM
e NB NM NS ZZ PS
PS PM
PM PB F 0.2PS
F 0.2ZZ
NB NB PB PB PM PM PS PS ZZ 0.2 NM 0.2 NM
0.2
NM NM PB PM PM PS PS
NM PS ZZ
ZZ NS 0.6 PS 0.4 PM
NSNS PM PM PS PS ZZ
ZZ NS
NS NS
NS
0.8 ZZ PM PS PS ZZ NS NS NM F 0.6ZZ
F 0.4NS
ZZ
PS PS PS ZZ NS NS NM NM 0.8 NS 0.8 NS
PS
PM PS ZZ NS NS NM NM NB
PM
PB ZZ NS NS NM NM NB NB
PB U
Oct 2017 Dr. Khaled El-Metwally, CU 24
Defuzzification
NB NM NS ZZ PS PM PB
0.6 PS 0.4 PM
0.2PS 0.2ZZ
F F
0.2 NM 0.2 NM
0.6 PS 0.4 PM
0.6ZZ 0.4NS
F F
0.8 NS 0.8 NS
The Center of Mass
U = -0.03
U
NB NM NS ZZ PS PM PB
zero= 2=
[ 0 1 1 1 0; [ 0 1 1 1 0;
1 0 0 0 1; 1 0 0 0 1;
1 0 0 0 1; 0 0 0 1 0;
1 0 0 0 1; 0 0 1 0 0;
1 0 0 0 1; 0 1 0 0 0;
1 0 0 0 1; 1 0 0 0 0;
0 1 1 1 0 ]; 1 1 1 1 1 ];
1=
[ 0 1 1 0 0;
0 0 1 0 0;
0 0 1 0 0;
0 0 1 0 0;
0 0 1 0 0;
0 0 1 0 0;
0 1 1 1 0 ];
Image map
Rsum1
Y
Rounding
FS Stage
Rsum7
Corresponding
FCR numeral output
m Slope =-b/2a
1
0.5
0
c
x
2a
0.6
0.4
0.2
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0.6
0.4
0.2
0
0 1 2 3 4 5 6 7 8 9
Then Y Zero
0
7
0
6
0
5
0
4
0
3
0
2
0
1
0
0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Noise standard deviation
1.5 4
1.5
s2 +2s+4
Step Ke
Ku Transfer Fcn y
Fuzzy Logic
du/dt 2 Controller
Derivative Kde
3 4
1
s2 +2s+4
Step Ke
Ku Transfer Fcn y
Fuzzy Logic
du/dt 2 Controller
Derivative Kde
•Hardware
1. Implementation of the fuzzy logic controller algorithm on an Atmel
micro controller or on proper micro controller simulator. You can use
the already available A/D and D/A on the Atmel chip / Arduino
board. The controller performance can be tested on any selected
physical model. A 2nd order R-C model simulation is an accepted
test model.
•Software
1. Tune PID to suitably control the position of a DC motor. Use a
suitable Fuzzy Logic Controller structure to replace the PID
controller. Use the pre-tuned model to generate the training data if
needed.
2. Use derivative based techniques to train a FLC to control the
position of a DC motor.