Membership Trapezoid function Plot

1 回表示 (過去 30 日間)
Ameri
Ameri 2023 年 1 月 2 日
コメント済み: Ameri 2023 年 1 月 14 日
How would I plot the membership Trapezoid function for the Last Hop based on the follwoing table please

採用された回答

Ameri
Ameri 2023 年 1 月 12 日
Thank you for your response, have you checked the table please.
  2 件のコメント
Ameri
Ameri 2023 年 1 月 13 日
Thank you so much dear Sam.
Sam Chak
Sam Chak 2023 年 1 月 13 日
You are welcome, @Ameri. If the MATLAB code and explanation are helpful, would you accepting ✔ and voting 👍 my Answer? 😅

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

その他の回答 (1 件)

Sam Chak
Sam Chak 2023 年 1 月 5 日
The range for Last Hop is not given. So, you might try something like this:
fis = mamfis;
% Option #1: using rectified linear MFs
fis = addInput(fis, [-1 +1], 'Name', 'LH1');
fis = addMF(fis, 'LH1', 'linzmf', [-0.25 0.25], 'Name', 'Bad');
fis = addMF(fis, 'LH1', 'linsmf', [-0.25 0.25], 'Name', 'Good');
% Option #2: using trapezoidal MFs
fis = addInput(fis, [-1 +1], 'Name', 'LH2');
fis = addMF(fis, 'LH2', 'trapmf', [-2 -1 -0.25 0.25], 'Name', 'Bad');
fis = addMF(fis, 'LH2', 'trapmf', [-0.25 0.25 +1 +2], 'Name', 'Good');
% Plots
figure(1)
subplot(2,1,1)
plotmf(fis, 'input', 1), grid on, title('Last Hop using rectified linear MFs')
subplot(2,1,2)
plotmf(fis, 'input', 2), grid on, title('Last Hop using trapezoidal MFs')
  2 件のコメント
Sam Chak
Sam Chak 2023 年 1 月 13 日
Hi @Ameri,
Thanks for you reply. If the MATLAB code is helpful in plotting the membership functions (MFs), please consider accepting ✔ and voting 👍 the Answer. Thanks a bunch! 🙏
By the way, I have checked the table and it looks like the Fuzzy Rules because of the word "Decision".
Also, I used two MFs because there are "Yes" and "No", assuming that "Bo" was a typo. I should have used "Yes" and "No", instead of "Good" and "Bad".
Two types of MFs are demonstrated: one is a rectified linear function, and the other is a trapezoidal function which you described in your problem. Both give the same shapes within the defined range in the Universe of Discourse , though I preferred the first approach.
I made up this range . You should define it according to what you know about the Last Hop data. If it is some kind of questionaire with the scale , then 1 and 2 are No, 3 is Indecisive (half no/half yes), 4 and 5 are Yes.
fis = mamfis;
fis = addInput(fis, [1 5], 'Name', 'LH');
fis = addMF(fis, 'LH', 'linzmf', [2 4], 'Name', 'No'); % Z-shaped, [Hi_value, Lo_value]
fis = addMF(fis, 'LH', 'linsmf', [2 4], 'Name', 'Yes'); % S-shaped, [Lo_value, Hi_value]
plotmf(fis, 'input', 1), grid on, title('Last Hop')
Ameri
Ameri 2023 年 1 月 14 日
Thank you.

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

カテゴリ

Help Center および File ExchangeFuzzy Inference System Modeling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by