I have a problem in which I have to define a fuzzy membership function with variable x(1) x(2) like below. For these variables I have to generate random number between 1 and 5. x(1)<x(2). What will be code for that?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a problem in which I have to define a fuzzy membership function with variable x(1) x(2) like below. For these variables I have to generate random number between 1 and 5. x(1)<x(2). What will be code for that? a=addmf(a,'input',1,'P','trimf',[0 x(1) x(2)]);
댓글 수: 0
답변 (1개)
Sam Chak
2024년 9월 23일
Set a constraint on
so that
.
fis = sugfis;
%% Random integer generator
n1 = 3;
n2 = 5 - n1;
x1 = randi(n1, 1);
x2 = randi(n2, 1) + x1; % ensures x1 < x2
%% Fuzzy Input 1
fis = addInput(fis, [-1 +5], 'Name', 'x');
fis = addMF(fis, 'x', 'trimf', [0 x1 x2], 'Name', 'P');
%% Plot membership functions for input 1
plotmf(fis, 'input', 1), grid on, title('MFs for 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!
