%%
clc
close all
clear
FIS = newfis('FIS','sugeno');
%%
% 定义输入E:
FIS = addvar(FIS,'input','E',[-10 10]);
FIS = addmf(FIS,'input',1,'Negative','gaussmf',[7 -10]);
FIS = addmf(FIS,'input',1,'Positive','gaussmf',[7 10]);
%%
% 定义输入CE:
FIS = addvar(FIS,'input','CE',[-10 10]);
FIS = addmf(FIS,'input',2,'Negative','gaussmf',[7 -10]);
FIS = addmf(FIS,'input',2,'Positive','gaussmf',[7 10]);
%%
% 定义输出u:
FIS = addvar(FIS,'output','u',[-20 20]);
FIS = addmf(FIS,'output',1,'Min','constant',-20);
FIS = addmf(FIS,'output',1,'Zero','constant',0);
FIS = addmf(FIS,'output',1,'Max','constant',20);
%%
% 定义规则:
% 格式:输入1~ 输入2~ 输出~ 权重(默认为:1)逻辑关系(1=and;2=or)
ruleList = [1 1 1 1 1;... % Rule 1
1 2 2 1 1;... % Rule 2
2 1 2 1 1;... % Rule 3
2 2 3 1 1];
FIS = addrule(FIS,ruleList);