The value of membership functions for x
4 次查看(过去 30 天)
显示 更早的评论
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/202927/image.jpeg)
0 个评论
回答(1 个)
Sam Chak
2022-9-16
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)
Y2 = evalmf(mf2, X)
Y3 = evalmf(mf3, X)
Y4 = evalmf(mf4, X)
Y5 = evalmf(mf5, X)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fuzzy Logic Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!