How to make an infinite interval for an input variable in fuzzy logic

8 views (last 30 days)
Hello! Can the input variable have infinite intervals to keep from going out of bounds? I understand that we can truncate data if it goes out of range before transferring it to a variable, but I would like not to do crutches.

Answers (1)

Sam Chak
Sam Chak on 15 Apr 2025 at 7:55
While it is impossible to have an infinite interval when designing the universe of discourse for a fuzzy variable (since infinity cannot be quantified in a strict numerical sense), it is possible to define the interval using the largest finite floating-point number in IEEE double precision. This number is referred to as realmax in MATLAB and is equal to:
.
With a number this large, it should be sufficient to simulate almost any physical laws and behaviors in the observable universe.
fis = sugfis;
% Fuzzy Input
fis = addInput(fis, [-realmax, realmax], 'Name', 'x');
fis = addMF(fis, 'x', 'linzmf', [-realmax/2, realmax/2], 'Name', 'Neg_BigBigBig');
fis = addMF(fis, 'x', 'linsmf', [-realmax/2, realmax/2], 'Name', 'Pos_BigBigBig');
% Fuzzy Output
fis = addOutput(fis, [-1, 1], 'Name', 'y');
fis = addMF(fis, 'y', 'constant', -realmax/2, 'Name', 'Neg_BigBigBig');
fis = addMF(fis, 'y', 'constant', realmax/2, 'Name', 'Pos_BigBigBig');
% Fuzzy Rules
rules = [
"x==Neg_BigBigBig => y=Neg_BigBigBig"
"x==Pos_BigBigBig => y=Pos_BigBigBig"
];
fis = addRule(fis, rules);
figure
plotmf(fis, 'input', 1, 1e5), grid on, grid minor
title('Input fuzzy sets')
figure
opt = gensurfOptions('NumGridPoints', 101);
gensurf(fis, opt), grid on, grid minor, ylim([-realmax, realmax])
title('Output')

Categories

Find more on Fuzzy Logic in Simulink in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!