to get output from fuzzy logic toolbox

11 visualizaciones (últimos 30 días)
MATHEW B K
MATHEW B K el 15 de Abr. de 2019
Respondida: Sam Chak el 16 de Sept. de 2022
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?

Respuestas (1)

Sam Chak
Sam Chak el 16 de Sept. de 2022
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;

Categorías

Más información sobre Fuzzy Inference System Modeling en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by