why i do Unrecognize variable addInput?

1 回表示 (過去 30 日間)
carolus aditya
carolus aditya 2023 年 1 月 19 日
編集済み: Abhinav 2023 年 1 月 19 日
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 Center および File ExchangeFuzzy Logic Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by