why i do Unrecognize variable addInput?

2 次查看(过去 30 天)
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

回答(1 个)

Abhinav
Abhinav 2023-1-19
编辑:Abhinav 2023-1-19
Hi carolus
fis1 = 'sugfis';
This is likely the cause of the error, remove the quotes from sugfis

类别

Help CenterFile Exchange 中查找有关 Fuzzy Logic Toolbox 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by