Fuzzy controller giving constant output of z = 0.5 (z range [0,1])
1 次查看(过去 30 天)
显示 更早的评论
MATLAB R2017B (9.3.0.713579) 64-bit (win 64)
Hi,
My fuzzy controller has one input and one output:
The membership functions and rules:
However, in the surface, the output1 starts in 0.5. I think that it should start in 0:
Am I wrong? Any help would be much appreciated.
Thanks in advance
0 个评论
回答(1 个)
Sam Chak
2022-9-17
There is nothing wrong. The reason the Crisp Output starts from is because the linear MF is chosen and the range of the Output MF is from 0 to 1. If the ruleview(fis) command is entered, one can clearly see the result of Aggregation, where the "mom" Defuzzification Method will be applied to obtain the crisp value.
If the Crisp Output value should starts from 0 to 1, then the range of the Output MF should be adjusted from to 1.
fis = mamfis('Name', "Test_FIS");
fis.DefuzzificationMethod = "mom";
fis
% Fuzzy Input #1
fis = addInput(fis, [0 1], 'Name', 'FuzIn');
fis = addMF(fis, 'FuzIn', 'linsmf', [0 1], 'Name', 'mfA');
% Fuzzy Output
fis = addOutput(fis, [-1 1], 'Name', 'FuzOut');
fis = addMF(fis, 'FuzOut', 'linsmf', [-1 1], 'Name', 'mfB');
% 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 = [...
"FuzIn==mfA => FuzOut=mfB"; ...
];
fis = addRule(fis, rules);
ruleview(fis)
% Generate output of Mamdani FIS
figure(2)
opt = gensurfOptions('NumGridPoints', 41);
[x, y, z] = gensurf(fis, opt);
plot(x, z, 'linewidth', 1.5), grid on
xlabel('FuzIn'), ylabel('FuzOut'), title('Crisp Output')
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!