Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

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?

Asked by MJ on 30 Apr 2013

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

MJ

Tags

Products

No products are associated with this question.

1 Answer

Answer by 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)

0 Comments

Iman Ansari

Contact us