How to implement the linear output function in Takagi–Sugeno Fuzzy System?
2 views (last 30 days)
Show older comments
hi, i want to implement Takagi Sugeno model in matlab using FIS, how can i set this rule:
"if x is large and y is small, then z=x+y+2"
of course i can add "If (x is large) and (y is small) then (Z is '...')", but i cannot add "x+y+2", how can i do it?
thanks so much
0 Comments
Answers (1)
Sam Chak
on 27 Sep 2024
Hi @m
To describe the equation (a flat plane surface), use the syntax 'linear', [1 1 2] in the addMF() command for the output z.
%% Sugeno fuzzy system
fis = sugfis;
%% Fuzzy Inputs, x and y
fis = addInput(fis, [0+eps 1], 'Name', 'x');
fis = addMF(fis, 'x', 'linsmf', [0 1], 'Name', 'large'); % Large fuzzy set
fis = addInput(fis, [0+eps 1], 'Name', 'y');
fis = addMF(fis, 'y', 'linzmf', [0 1], 'Name', 'small'); % Small fuzzy set
%% Fuzzy Output, z = 1·x + 1·y + 2
fis = addOutput(fis, [2 4], 'Name', 'z');
fis = addMF(fis, 'z', 'linear', [1 1 2], 'Name', 'Eq1');
%% Rule: If (x is large) and (y is small), Then (Z is Eq1 = x + y + 2)
rule = "x==large & y==small => z=Eq1";
fis = addRule(fis, rule);
%% The surface
opt = gensurfOptions('NumGridPoints', 101);
gensurf(fis, opt), grid on, grid minor, zlim([2 4])
0 Comments
See Also
Categories
Find more on Fuzzy Logic Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!