In the rule viewer in the Fuzzy toolbox, how to to insert many inputs at one time and get the output automatically in the text format?
3 views (last 30 days)
Show older comments
I have a question regarding the Fuzzy tool in the Mathlab. In the rule viewer, is there any way to insert many inputs at one time and get the output automatically in the text format or excel format?
For the time being, I have to insert the inputs one at a time to get the calculated output. This is time consuming because I have many inputs to be processed.
Thank you.
0 Comments
Answers (1)
Iman Ansari
on 30 Apr 2013
Hi. You can use evalfis :
a = newfis('fis1.fis'); %create a new FIS file
a = addvar(a, 'input', 'x', [2 9]);%add and input variable 'x' into the FIS
a = addmf(a, 'input', 1, 'A1', 'trimf', [2 5 8]);%add 2 MFs into the variable x
a = addmf(a, 'input', 1, 'A2', 'trimf', [3 6 9]);
a = addvar(a, 'input', 'y', [4 11]);%add and input variable 'y' into the FIS
a = addmf(a, 'input', 2, 'B1', 'trimf', [5 8 11]);%add 2 MFs into the variable y
a = addmf(a, 'input', 2, 'B2', 'trimf', [4 7 10]);
a = addvar(a, 'output', 'z', [1 9]);%add and output variable 'z' into the FIS
a = addmf(a, 'output', 1, 'C1', 'trimf', [1 4 7]);%add 2 MFs into the variable z
a = addmf(a, 'output', 1, 'C2', 'trimf', [3 6 9]);
rulelist = [1 1 1 1 1;
-1 2 2 1 1;]; %2 rule is defined and added into FIS
a = addrule(a, rulelist);
writefis(a, 'fis1.fis');
ruleview fis1
b=readfis('fis1');
% outputs
out1=evalfis([5 8; 6 9; 8 10;3 5;5.5 7.7],b)
1 Comment
Sanchit Saran Agarwal
on 25 May 2021
Edited: Sanchit Saran Agarwal
on 25 May 2021
Sir, this program is not running in MATLAB. The error says, matlab:matlab.internal.language.introspective.errorDocCallback()
See Also
Categories
Find more on Fuzzy Logic Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!