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

조회 수: 3 (최근 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
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 CenterFile Exchange에서 Fuzzy Logic Toolbox에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by