How to create membership functions matlab in triangular form?
3 ビュー (過去 30 日間)
古いコメントを表示
Hi, hoping somone can help
i add the rule 1 and 2 with trimf function but how can i plot the rule 3 and 4 pleas (see the attched images) thanks
)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/647370/image.png)
0 件のコメント
回答 (2 件)
Sam Chak
2022 年 3 月 22 日
編集済み: Sam Chak
2022 年 3 月 22 日
Hi @mindo akami
You probably have already learned the manual way to plot these. Since this is unanswered and if you are still interested in learning to plot the 'fuzzy way', here is the code:
x = -180:0.1:180; % set the domain of discourse
y1 = trimf(x,[-90 0 90]); % Rule 1
y2 = 1 - y1; % Rule 2
y3 = trimf(x,[-180 -90 -90]) + trimf(x,[90 90 180]); % Rule 3
y4 = trimf(x,[-180 -180 -90]) + trimf(x,[90 180 180]); % Rule 4
h = plot(x, y1, 'r-', x, y2, 'g-', x, y3, 'b-', x, y4, 'm-');
set(h, 'LineWidth', 1.5)
xticks([-180 -90 0 90 180]);
xlabel('x_{1}, (degree)');
ylabel('Degree of Membership, \mu');
The line colors follow the original image that you posted here:
Result:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/937624/image.png)
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!