How to obtain the fuzzy input membership grades for all MFs given an input value
5 views (last 30 days)
Show older comments
Hi and Good Day all,
I need your help in the following:
When we evaluate a set of input, either using evalfis function or through the FIS Editor menu of View->Rules, how do we get the input's membership grades for each input membership functions that we have? Let say I have 3 input membership functions ie. Good, Moderate and Poor. So how do I get the grades for all of these 3 MF. The evalfis and View->Rules menu only display the output results. I also found out that I have the similar problem to get the grades of the input MF in the Interval Type-2 Fuzzy Toolbox.
I really hope to get some help from the group. Thank you very much in advance for your time and concern.
0 Comments
Answers (1)
Sam Chak
on 16 Apr 2025
Hi @mhilmi
Other than the evalfis() function, the evalmf() function can be used to obtain the membership function values.
%% initialize the FIS type
fis = mamfis;
%% add fuzzy variable
fis.Inputs(1) = fisvar([0 10], "Name", "Performance");
%% add fuzzy membership functions
fis.Inputs(1).MembershipFunctions(1) = fismf("linzmf", [2 5 ], "Name", "Poor");
fis.Inputs(1).MembershipFunctions(2) = fismf( "trimf", [2 5 8], "Name", "Moderate");
fis.Inputs(1).MembershipFunctions(3) = fismf("linsmf", [ 5 8], "Name", "Good");
%% evaluate multiple MFs to get the membership function values
xinput = 6;
MFs_mu = evalmf(fis.Inputs(1).MembershipFunctions, xinput)
%% plot results
figure
hold on
plotmf(fis, 'input', 1, 1001), ylim([-0.5, 1.5])
grid on, title('Input fuzzy sets')
plot(xinput, MFs_mu(2), 'ko')
plot(xinput, MFs_mu(3), 'ko')
hinput = line([xinput xinput], [-0.2 1.0], 'Color', '#7F7F7F', 'LineStyle','--');
tinput = text(xinput-0.5, -0.25,' input', 'FontWeight', 'bold');
hold off
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!