How to get an output value for a Mamdani fuzzy system using evalfis() command
2 views (last 30 days)
Show older comments
How I can get the output value for mamdani fuzzy system using this command evalfis([1 2],fis).
FIS Evaluation: To evaluate the output of a fuzzy system for a given input combination, use the evalfis command. For example, evaluate a using input variable values of 1 and 2. evalfis([1 2],fis) ans = 5.5586 You can also evaluate multiple inputs.
0 Comments
Answers (1)
Sam Chak
on 27 Apr 2025
It is likely simpler than you have anticipated if you design the Mamdani system correctly according to mathematical reasoning procedure.
%% Design a Mamdani fuzzy system called "fis"
fis = mamfis;
% Fuzzy Input 1
fis = addInput(fis, [0 2], 'Name', 'in1');
fis = addMF(fis, 'in1', 'trimf', [0 1 2], 'Name', 'All-Encompassing');
% Fuzzy Input 2
fis = addInput(fis, [1 3], 'Name', 'in2');
fis = addMF(fis, 'in2', 'trimf', [1 2 3], 'Name', 'All-Encompassing');
% Fuzzy Output 1
fis = addOutput(fis, [3 8], 'Name', 'out');
val = 5.5586; % desired value
fis = addMF(fis, 'out', 'trimf', [val-2 val val+2], 'Name', 'myValue');
% Fuzzy Rule
fis = addRule(fis, "If in1 is All-Encompassing and in2 is All-Encompassing then out is myValue");
%% Testing evalfis output
input1 = 1;
input2 = 2;
output = evalfis(fis, [input1, input2])
plotrule(fis, Inputs=[1, 2])
0 Comments
See Also
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!