Clear Filters
Clear Filters

why i do Unrecognize variable addInput?

2 views (last 30 days)
carolus aditya
carolus aditya on 19 Jan 2023
Edited: Abhinav on 19 Jan 2023
I had a problem in running mscript fuzzy in matlab 2022 (Unrecognize variable addInput). How can i fix that?
There is a script
fis1 = 'sugfis';
% Define input variables and ranges
fis1 = addInput(fis1,[-1 1],'Name','E');
fis1 = addInput(fis1, [-1 1],'Name','delE');
% Define mf’s of input variable
fis1 = addMF(fis1,'E','trimf',[-1 -1 0],'Name','N');
fis1 = addMF(fis1,'E','trimf',[-1 0 1],'Name','Z');
fis1 = addMF(fis1,'E','trimf',[0 1 1],'Name','P');
fis1 = addMF(fis1,'delE','trimf',[-1 -1 0],'Name','N');
fis1 = addMF(fis1,'delE','trimf',[-1 0 1],'Name','Z');
fis1 = addMF(fis1,'delE','trimf',[0 1 1],'Name','P');
% Define output variables and ranges
fis1 = addOutput(fis1,[-1 1],'Name','U');
% Define mf’s of output variable
fis1 = addMF(fis1,'U','constant',[-1],'Name','NL');
fis1 = addMF(fis1,'U','constant',[-0.8],'Name','NS');
fis1 = addMF(fis1,'U','constant',[0],'Name','Z');
fis1 = addMF(fis1,'U','constant',[0.8],'Name','PS');
fis1 = addMF(fis1,'U','constant',[1],'Name','PB');
rules = [...
"E==N & delE==N => U=NL"; ...
"E==Z & delE==N => U=NS"; ...
"E==P & delE==N => U=Z"; ...
"E==N & delE==Z => U=NS"; ...
"E==Z & delE==Z => U=Z"; ...
"E==P & delE==Z => U=PS"; ...
"E==N & delE==P => U=Z"; ...
"E==Z & delE==P => U=PS"; ...
"E==P & delE==P => U=PB"; ...
];
% Add rule table
fis1 = addRule(fis1,rules);
There is a problem
Error in TIPE1 (line 3)
fis1 = addInput(fis1,[-1 1],'Name','E');
Thanks Before
Regards,
Carolus

Answers (1)

Abhinav
Abhinav on 19 Jan 2023
Edited: Abhinav on 19 Jan 2023
Hi carolus
fis1 = 'sugfis';
This is likely the cause of the error, remove the quotes from sugfis

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!