to get output from fuzzy logic toolbox

조회 수: 13 (최근 30일)
MATHEW B K
MATHEW B K 2019년 4월 15일
답변: Sam Chak 2022년 9월 16일
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?

답변 (1개)

Sam Chak
Sam Chak 2022년 9월 16일
The graph or output values from the surface viewer on the Fuzzy Logic App are actually defuzzified output values.
To view the defuzzified output values for specific input values or vector, use evalfis() function.
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)
output_U = 2×1
0.4904 -0.4904
q = plot(input_E, output_U, 'o', 'MarkerSize', 10);
q.LineWidth = 1.5;

카테고리

Help CenterFile Exchange에서 Fuzzy Inference System Modeling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by