to get output from fuzzy logic toolbox

11 ビュー (過去 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 Center および File ExchangeFuzzy Inference System Modeling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by