Fuzzy logic rule for out of range
Show older comments
I implemented a fuzzy logic penalty system for a particle swarm algorithm i'm working on.
Sometimes it may happen that the values considered are out of the range defined in the fuzzy logic [0 1], so i get this warning:
Warning: Input 1 expects a value in range [0 1], but has a value of 1.06985.
and by default the defuzzifier does this:
Warning: No rules fired for Output 1. Defuzzified output value set to its mean range value 0.05.
Is there a way to set a rule for the out of range values so that its default output is an arbitrary value decided by me and not the mean?
Basically i would like to keep both warnings, and have the second one like this:
Warning: No rules fired for Output 1. Defuzzified output value set to MY ARBITRARY VALUE LET'S SAY 2.
Note: i know i could just expand the fuzzy range to fit, but it would be a blind guess since i don't actually know the upper bound. If nothing works i'll do it like this (expanding to let's say to [0 1.5], so a 50% margin).
Note2: i cannot attach the fuzzy logic beacuse .fis files upload is not supported, i'll just copy paste it in the comments:
1 Comment
Luca Ferro
on 9 Feb 2023
Accepted Answer
More Answers (1)
Thanks for the sketch. I don't know your desired intervals, but linsmf should be the one that looks like your sketch.
MF6='outofrange':'linsmf', [param(1) param(2)], 2
The function looks like this:
x = 0.5:0.01:3;
y = linsmf(x, [1.0 1.5]);
plot(x, y, 'linewidth', 1.5), grid on
title('Linear Saturation function')
xlabel('linsmf, P = [1.0 1.5]')
ylabel('Membership')
ylim([-0.05 1.05])
1 Comment
Luca Ferro
on 22 Mar 2023
Categories
Find more on Fuzzy Logic in Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
