Fuzzy & ANFIS
USE MATLAB
EMAN KONSOWA
Outline
Fuzzy logic toolbox
Fuzzy: use command line
Fuzzy: use GUI
ANFIS: use command line
ANFIS: use GUI
Outline
Fuzzy logic toolbox
Fuzzy: use command line
Fuzzy: use GUI
ANFIS: use command line
ANFIS: use GUI
Membership function
Trimf Sigmf
Trapmf
Dsigmf
Gbellmf
Psigmf
Pimf
Gaussmf
Smf
Gauss2mf
Zmf
Combination of (Rules)
1. if (x is A) and (y is B) then (z is α)(1)
2. if (x is A) or (y is C) then (z is β)(1)
1. (x == A) & (y == B) => (z == α)(1)
2. (x ==A) | (y == C) => (z == β)(1)
開啟 MATLAB 並新增一個 M-file
Input1
[Input1] Name='service';
Range=[0 10]; NumMFs=3;
MF1='poor':'gaussmf',[1.5 0];
MF2='good':'gaussmf',[1.5 5];
MF3='excellent':'gaussmf',[1.5 10];
Input1
Input2
[Input2]
Name='food';
Range=[0 10];
NumMFs=2;
MF1='rancid':'trapmf',[0 0 1 3];
MF2='delicious':'trapmf',[7 9 10 10];
Input2
Output1
[Output1];
Name='tip';
Range=[0 30];
NumMFs=3;
MF1='cheap':'trimf',[0 5 10];
MF2='average':'trimf',[10 15 20];
MF3='generous':'trimf',[20 25 30];
Output1
Rules
If (service is poor) or (food is rancid) then (tip is cheap) (1)
If (service is good) then (tip is average) (1)
If (service is excellent) or (food is delicious) then (tip is
generous) (1)
Graph of inputs - outputs
Outline
Fuzzy logic toolbox
Fuzzy: use command line
Fuzzy: use GUI
ANFIS: use command line
ANFIS: use GUI
FUZZY LOGIC TOOLBOX
GUI
在 MATLAB command window 輸入 fuzzy
Add -input/output
Changing the input name
MF choosing
Range of MF
MF Type
MF range
Service
Food
Tip
Rules
Tipper
Tipper
Thanks!!