to get output from fuzzy logic toolbox
조회 수: 13 (최근 30일)
이전 댓글 표시
i want the output as probability value but i am only getting a graph. i want to know how can we obtain values from surface viewer of fuzzy logic toolbox of Matlab software?
댓글 수: 0
답변 (1개)
Sam Chak
2022년 9월 16일
The graph or output values from the surface viewer on the Fuzzy Logic App are actually defuzzified output values.
fis = mamfis('Name', "Test_FIS");
% Fuzzy Input #1
fis = addInput(fis, [-1 1], 'Name', 'E');
fis = addMF(fis, 'E', 'zmf', [-0.5 0.25], 'Name', 'N');
fis = addMF(fis, 'E', 'gaussmf', [0.25 0], 'Name', 'Z');
fis = addMF(fis, 'E', 'smf', [-0.25 0.5], 'Name', 'P');
% Fuzzy Output
fis = addOutput(fis, [-1 1], 'Name', 'U');
fis = addMF(fis, 'U', 'zmf', [-0.5 0.25], 'Name', 'N');
fis = addMF(fis, 'U', 'gaussmf', [0.25 0], 'Name', 'Z');
fis = addMF(fis, 'U', 'smf', [-0.25 0.5], 'Name', 'P');
% Plot Membership functions
figure(1)
subplot(2,1,1)
plotmf(fis, 'input', 1), grid on, title('Input')
subplot(2,1,2)
plotmf(fis, 'output', 1), grid on, title('Output')
% Fuzzy Rules
rules = [...
"E==N => U=N"; ...
"E==Z => U=Z"; ...
"E==P => U=P"; ...
];
fis = addRule(fis, rules);
% Generate output of Mamdani FIS
figure(2)
opt = gensurfOptions('NumGridPoints', 201);
gensurf(fis, opt), grid on
hold on
input_E = [0.5 -0.5];
output_U = evalfis(fis, input_E)
q = plot(input_E, output_U, 'o', 'MarkerSize', 10);
q.LineWidth = 1.5;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Fuzzy Inference System Modeling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!