Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

Introduction to Neural Networks

and Fuzzy Logic


Lecture 4

Dr.-Ing. Erwin Sitompul


President University
http://zitompul.wordpress.com
2 0 2 0
President University Erwin Sitompul NNFL 4/1
Fuzzy Logic Fuzzy Control

Solution: Homework 3
v. small small perfect big v. big declining constant growing
1 1

0.6 0.75
0.4
0.25
0 5 10 15 20 25 –10 –5 0 5 10
distance to next car [m] speed change [m/s ]
2

13 m 2.5 m/s2

–big –small zero +small +big


1

–2 –1 0 1 2
acceleration adj. [m/s2]

President University Erwin Sitompul NNFL 4/2


Fuzzy Logic Fuzzy Control

Solution: Homework 3 (Cont.)


0.4 0
 Rule 1: IF distance is small AND speed is declining,
THEN maintain acceleration. 0
0.4 0.75
Rule 2: IF distance is small AND speed is constant, 0.4
THEN acceleration adjustment negative small.
0.6
Rule 3: IF distance is perfect AND speed is declining,
0
THEN acceleration adjustment positive small. 0

perfect AND speed is 0.75


Rule 4: IF distance is 0.6 constant,
THEN maintain acceleration.
0.6

FL-Operators:
AND  Min
OR  Max
President University Erwin Sitompul NNFL 4/3
Fuzzy Logic Fuzzy Control

Solution: Homework 3 (Cont.)


–big –small zero +small +big
1

0.6
0.4
A1  0.4 2  (2.2  3)  1.04
–2 –1 0 1 2
acceleration adj. [m/s2] c1  0.5

1 A2  0.2 2  (0.8  1.2)  0.2


c2  0
A  h 2  ( a  b) A2
A1 c1 A1  c2 A2
cx 
–2 –1 0 1 2 A1  A2
acceleration change [m/s2]
 0.4194 m s 2

President University Erwin Sitompul NNFL 4/4


Fuzzy Logic Fuzzy Control

Solution: Homework 3 (Cont.)


Finding Solution in Matlab
Input 1 MFs
Input 2 MFs
Output MFs

Rule Viewer
President University Erwin Sitompul NNFL 4/5
Fuzzy Logic Fuzzy Control

Fuzzy Logic Toolbox in Matlab


 The toolbox can be opened by
typing “fuzzy” in Matlab
Workspace.
 Some variables must be
defined:
 Number of inputs and outputs
 Membership functions of each
input and output
 Fuzzy rules that will connect
the membership functions
 Fuzzy set operators, inference
core, accumulation, and
defuzzification
 Further complete explanation
can be found in Matlab Fuzzy
Toolbox User’s Guide.

President University Erwin Sitompul NNFL 4/6


Fuzzy Logic Fuzzy Control

Fuzzy Logic Toolbox in Matlab


 And and OR method pairs:
 Min-max
 Prod-probor (algebraic
product/sum)
 Implication:
 Min (clipping)
 Prod (scaling)
 Aggregation :
max (accumulation).
 Defuzzification :
centroid (center of gravity).

President University Erwin Sitompul NNFL 4/7


Fuzzy Logic Fuzzy Control

Fuzzy Logic Toolbox in Matlab


 Now, we utilize the fuzzy toolbox to analyze the input-
output behavior of the fuzzy control.
 Later, the resulting fuzzy control can be applied to control
dynamic systems in Simulink environment.
 In each session, remember to save and re-open the
controller that has been designed:
 Save files using Files >> Export >> To Disk
 Open files using Files >> Import >> From Disk

President University Erwin Sitompul NNFL 4/8


Fuzzy Logic Fuzzy Control

Homework 4A
 Read the manual of Fuzzy Logic Toolbox carefully.
 Learn how to use the toolbox and get familiar with it.
 Redo the HW 3A in Matlab using Fuzzy Logic Toolbox. Print
and submit the followings via Google Classroom:
 The screenshots of the membership functions, the rules,
and the rule viewer (the rule accumulation).
 The *.fis file of the fuzzy control.

 Submission must be complete.


 Incomplete submission will not be graded.

 Deadline: Thursday, 4 June 2020


(Evening and Morning Class).

President University Erwin Sitompul NNFL 4/9

You might also like