tutorial on fuzzy logic using matlab
TRANSCRIPT
![Page 1: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/1.jpg)
Tutorial on Fuzzy Logic using
MATLAB
Adel Abdennour,
Electrical Engineering Department,
King Saud University
![Page 2: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/2.jpg)
Outline
• Fuzzy Logic Toolbox
• FIS Editor
• Tipping Problem: Fuzzy Approach
• Defining Inputs & Outputs
• Defining MFs
• Defining Fuzzy Rules
![Page 3: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/3.jpg)
MATLAB: Fuzzy Logic Toolbox
![Page 4: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/4.jpg)
MATLAB: Fuzzy Logic Toolbox
![Page 5: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/5.jpg)
FIS Editor
![Page 6: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/6.jpg)
Tipping Problem
• Given a number between 0 and 10 that represents the quality
of service at a restaurant (where 10 is excellent), and another
number between 0 and 10 that represents the quality of the
food at that restaurant (again, 10 is excellent), what should
the tip be?
• Assume that an average tip is 15%, a generous tip is 25%, and a
cheap tip is 5%.
6
![Page 7: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/7.jpg)
Tipping Problem: Fuzzy Approach
• Antecedent
• Service
• Food
• Consequent
• Tip
• Membership Function
• Service : poor , good, excellent
• Food : rancid, delicious
• Tip : cheap, average, generous
7
![Page 8: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/8.jpg)
FIS Editor: Adding Input / Output
![Page 9: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/9.jpg)
Tipping Problem: Defining Input & outputs
![Page 10: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/10.jpg)
Tipping Problem: Membership Function
• Membership Function: Service
• Let,
• Poor : 0-5
• Good : 2.5 – 7.5
• Excellent : 5- 10
![Page 11: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/11.jpg)
Tipping Problem: Membership Function
![Page 12: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/12.jpg)
Tipping Problem: Membership Function
• Membership Function:
Tip
• Let,
• Cheap : 0 - 15
• Average : 7.5 – 22.5
• Generous : 15 - 30
![Page 13: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/13.jpg)
Tipping Problem: Fuzzy RulesWhat we want to express is:
or
1. If service is poor and the food is rancid then tip is cheap
2. If service is good and the food is rancid then tip is cheap
3. If service is poor and the food is delicious then tip is Average
4. If service is good and the food is delicious then tip is Average
5. If service is excellent then tip is generous
We have just defined the rules for a fuzzy logic system.
Rancid Delicious
Poor Cheap Average
Good Cheap Average
Excellent Generous Generous
13
![Page 14: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/14.jpg)
Tipping Problem: Fuzzy Rules
![Page 15: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/15.jpg)
Tipping Problem: Fuzzy Rules
![Page 16: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/16.jpg)
Saving FIS
![Page 17: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/17.jpg)
Rule Viewer
![Page 18: Tutorial on Fuzzy Logic Using MATLAB](https://reader036.vdocuments.net/reader036/viewer/2022081716/552e57f84a79593c578b488f/html5/thumbnails/18.jpg)
Surface Viewer