The value of membership functions for x

3 views (last 30 days)
hi
how to define the output fuzzy set as fuzzy values - which mean's that the outputs membership functions multi-valued as in picture below .
So in Matlab for example I want to ses the MF value for the input X.
Which code or function should use to have the values of MF as outputs if x is a vector e.g. x= [2 5.5 23 14 6.5 7 9 20]?
Thanks in advance

Answers (1)

Sam Chak
Sam Chak on 16 Sep 2022
To obtain the fuzzy set values, the evalmf() function can be used. In this example, the fuzzy sets are constructed using the Gaussian Membership functions:
x = 0:0.1:25;
mf1 = fismf("gaussmf", [2, 0]);
mf2 = fismf("gaussmf", [2, 5]);
mf3 = fismf("gaussmf", [2, 10]);
mf4 = fismf("gaussmf", [2, 15]);
mf5 = fismf("gaussmf", [2, 20]);
y1 = evalmf(mf1, x);
y2 = evalmf(mf2, x);
y3 = evalmf(mf3, x);
y4 = evalmf(mf4, x);
y5 = evalmf(mf5, x);
plot(x, [y1; y2; y3; y4; y5]'), grid on, ylim([-0.2 1.2]), xlabel('\it{x}'), ylabel('\mu(\it{x})')
If we want to find the MF values over specific input values in x, then the following syntax is used:
X = [2 5.5 23 14 6.5 7 9 20];
Y1 = evalmf(mf1, X)
Y1 = 1×8
0.6065 0.0228 0.0000 0.0000 0.0051 0.0022 0.0000 0.0000
Y2 = evalmf(mf2, X)
Y2 = 1×8
0.3247 0.9692 0.0000 0.0000 0.7548 0.6065 0.1353 0.0000
Y3 = evalmf(mf3, X)
Y3 = 1×8
0.0003 0.0796 0.0000 0.1353 0.2163 0.3247 0.8825 0.0000
Y4 = evalmf(mf4, X)
Y4 = 1×8
0.0000 0.0000 0.0003 0.8825 0.0001 0.0003 0.0111 0.0439
Y5 = evalmf(mf5, X)
Y5 = 1×8
0.0000 0.0000 0.3247 0.0111 0.0000 0.0000 0.0000 1.0000

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!