How to design a Fuzzy System for the Fuzzy Relation (A∪C)∩(B∪D)

8 views (last 30 days)
Please I need your help for my academic research. I am working on a fuzzy logic based system involving four inputs say A,B,C,D and an output E. Each of them are defined by three linguistic variables(HIGH,MEDIUM,LOW) ,summing to 81(3^4) rules. The fuzzy logic relation is E=(AUC)n(BUD)...my problem is this. I can not use the default MATLAB FIS because of the number of inputs and because of the nature of the fuzzy logic operation involved. Please, I proposed to use a triangular membership function meaning that there will be case of a crisp value having more than one linguistic value. Hence, aggregriaton of rules will be more than complex and funny because many rules would be turned on . I propose to define a linguistic variable only on where the fuzzifier (membership function) gives higher value in order to silence aggregation of rules. is it right to go on with that? I have seen a publication where linguistic variable is defined on where membership function is maximum hence eliminating rule aggregation. Thank you and I look forward to hearing from you soonest.

Answers (1)

Sam Chak
Sam Chak on 1 May 2025
The response is a bit late, but this is an interesting problem. If you use three fuzzy sets for each of the four inputs {A, B, C, D}, the maximum number of rules generated by the grid partition technique is 81 rules, which can be relatively overwhelming for humans to design. To reduce the number of rules, modern fuzzy practitioners tend to use the Modular FIS Architecture. Some refer to this as the Hierarchical FIS Structure, while MATLAB calls it the FIS Tree. However, they all refer to the same concept.
Given that you have a clear fuzzy logic relation, , you can divide the operation by designing two FIS OR modules and one FIS AND module, and then assemble them using the fistree() command. In the demo below, I use Boolean operations to describe the fuzzy logic relation for ease of understanding.
%% Fuzzy Boolean OR for inputs A & C
fis1 = sugfis('Name', 'fis1OR');
% Fuzzy Input 1
fis1 = addInput(fis1, [0 1], 'Name', 'A');
fis1 = addMF(fis1, 'A', 'linzmf', [0.5 0.5], 'Name', '0');
fis1 = addMF(fis1, 'A', 'linsmf', [0.5 0.5], 'Name', '1');
% Fuzzy Input 2
fis1 = addInput(fis1, [0 1], 'Name', 'C');
fis1 = addMF(fis1, 'C', 'linzmf', [0.5 0.5], 'Name', '0');
fis1 = addMF(fis1, 'C', 'linsmf', [0.5 0.5], 'Name', '1');
% Fuzzy Output
fis1 = addOutput(fis1, [0 1], 'Name', 'AuC');
fis1 = addMF(fis1, 'AuC', 'constant', 0, 'Name', '0');
fis1 = addMF(fis1, 'AuC', 'constant', 1, 'Name', '1');
% Fuzzy Rules (Boolean OR)
rules = [
"A==0 & C==0 => AuC=0"
"A==0 & C==1 => AuC=1"
"A==1 & C==0 => AuC=1"
"A==1 & C==1 => AuC=1"
];
fis1 = addRule(fis1, rules);
%% Fuzzy Boolean OR for inputs B & D
fis2 = sugfis('Name', 'fis2OR');
% Fuzzy Input 1
fis2 = addInput(fis2, [0 1], 'Name', 'B');
fis2 = addMF(fis2, 'B', 'linzmf', [0.5 0.5], 'Name', '0');
fis2 = addMF(fis2, 'B', 'linsmf', [0.5 0.5], 'Name', '1');
% Fuzzy Input 2
fis2 = addInput(fis2, [0 1], 'Name', 'D');
fis2 = addMF(fis2, 'D', 'linzmf', [0.5 0.5], 'Name', '0');
fis2 = addMF(fis2, 'D', 'linsmf', [0.5 0.5], 'Name', '1');
% Fuzzy Output
fis2 = addOutput(fis2, [0 1], 'Name', 'BuD');
fis2 = addMF(fis2, 'BuD', 'constant', 0, 'Name', '0');
fis2 = addMF(fis2, 'BuD', 'constant', 1, 'Name', '1');
% Fuzzy Rules (Boolean OR)
rules = [
"B==0 & D==0 => BuD=0"
"B==0 & D==1 => BuD=1"
"B==1 & D==0 => BuD=1"
"B==1 & D==1 => BuD=1"
];
fis2 = addRule(fis2, rules);
%% Fuzzy Boolean AND for outputs of fis1 & fis2
fis3 = sugfis('Name', 'fisAND');
% Fuzzy Input 1
fis3 = addInput(fis3, [0 1], 'Name', 'in1');
fis3 = addMF(fis3, 'in1', 'linzmf', [0.5 0.5], 'Name', '0');
fis3 = addMF(fis3, 'in1', 'linsmf', [0.5 0.5], 'Name', '1');
% Fuzzy Input 2
fis3 = addInput(fis3, [0 1], 'Name', 'in2');
fis3 = addMF(fis3, 'in2', 'linzmf', [0.5 0.5], 'Name', '0');
fis3 = addMF(fis3, 'in2', 'linsmf', [0.5 0.5], 'Name', '1');
% Fuzzy Output
fis3 = addOutput(fis3, [0 1], 'Name', 'out');
fis3 = addMF(fis3, 'out', 'constant', 0, 'Name', '0');
fis3 = addMF(fis3, 'out', 'constant', 1, 'Name', '1');
% Fuzzy Rules (Boolean AND)
rules = [
"in1==0 & in2==0 => out=0"
"in1==0 & in2==1 => out=0"
"in1==1 & in2==0 => out=0"
"in1==1 & in2==1 => out=1"
];
fis3 = addRule(fis3, rules);
%% create a FIS Tree for E = (A∪C)∩(B∪D)
% connections
con1 = ["fis1OR/AuC", "fisAND/in1"];
con2 = ["fis2OR/BuD", "fisAND/in2"];
tree = fistree([fis1 fis2 fis3], [con1; con2]);
plotfis(tree)
%% Generate input and output truth values using evalfis
inputA = [zeros(1, 8), ones(1, 8)];
C = 1 - (1 + (-1).^(repmat([0:3], 4, 1)))/2;
inputC = C(:)';
B = 1 - (1 + (-1).^([0:7; 0:7]))/2;
inputB = B(:)';
inputD = 1 - (1 + (-1).^(0:15))/2;
logicalInputs = [inputA' inputB' inputC' inputD'];
logicalOutput = evalfis(tree, logicalInputs);
%% Create Fuzzy Boolean Truth Table using array2table
BooleanTable = array2table([logicalInputs logicalOutput], 'VariableNames', {'A', 'C', 'B', 'D', '(AuC)n(BuD)'})
BooleanTable = 16x5 table
A C B D (AuC)n(BuD) _ _ _ _ ___________ 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 1 0 0 1 0 0 0 0 1 1 0 0 1 1 0 1 0 1 1 1 1 1 0 0 0 0 1 0 0 1 1 1 1 0 0 0 1 1 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1
%% Visualization of Boolean Operations
opt = gensurfOptions('NumGridPoints', 1001);
figure
gensurf(fis1, opt);
colormap copper
shading interp
light
lighting phong
title('Boolean OR Logical Operations')
figure
gensurf(fis3, opt);
colormap sky
shading interp
light
lighting phong
title('Boolean AND Logical Operations')

Categories

Find more on Fuzzy Logic Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!