How to plot 3 membership function and find the µ of each one for a specific X ?

4 ビュー (過去 30 日間)
Hello ,
i want to plot 3 trapezoidal membership functions : the first one is : [ 0 0.3 0.4] second [0.3 0.4 0.6 0.7] third [0.6 0.7 1 ] like this
and i have a table of points that i want to plot here and get the membership function of each one i found how to do it with one function but not with 3 .
thank you for the help .

採用された回答

Sam Chak
Sam Chak 2022 年 6 月 2 日
編集済み: Sam Chak 2022 年 6 月 2 日
You can refer to doc trapmf, and plot the membership functions.
Edit: To include the firing of fuzzy membership value μ corresponding to the x value,
x = 0:0.01:1;
y1 = trapmf(x, [-0.1 0.0 0.3 0.4]);
y2 = trapmf(x, [0.3 0.4 0.6 0.7]);
y3 = trapmf(x, [0.6 0.7 1.0 1.1]);
plot(x, y1, x, y2, x, y3, 'linewidth', 1.5)
hold on
xMark = 0.67;
y1Mark = trapmf(xMark, [-0.1 0.0 0.3 0.4]);
y2Mark = trapmf(xMark, [0.3 0.4 0.6 0.7]);
y3Mark = trapmf(xMark, [0.6 0.7 1.0 1.1]);
plot(xMark*x, y2Mark*ones(size(x)), '--', 'linewidth', 1.25)
plot(xMark*x, y3Mark*ones(size(x)), '--', 'linewidth', 1.25)
plot(xMark*ones(size(x)), y3Mark*x, '--', 'linewidth', 1.25)
hold off
grid on
ylim([-0.2 1.4])
xlabel('x')
ylabel('Degree of Membership, \mu')
legend('faible', 'moyenne', 'forte', 'location', 'best')
  4 件のコメント
redha wassim brahimi
redha wassim brahimi 2022 年 6 月 2 日
thank you accepted !
Sam Chak
Sam Chak 2022 年 6 月 2 日
Thanks for your acceptance. I have edited the original Answer to include the firing of fuzzy membership value μ corresponding to the x value. I think you will like this, because you have more control over the plot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFuzzy Logic Toolbox についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by