Working from the Command Line

The tipping system is one of many examples of fuzzy inference systems provided with the Fuzzy Logic Toolbox. The FIS is always cast as a MATLAB structure. To load this system (rather than bothering with creating it from scratch), type

a = readfis('tipper.fis')

MATLAB will respond with

a = 
            name: 'tipper'
            type: 'mamdani'
       andMethod: 'min'
        orMethod: 'max'
    defuzzMethod: 'centroid'
       impMethod: 'min'
       aggMethod: 'max'
           input: [1x2 struct]
          output: [1x1 struct]
            rule: [1x3 struct]

The labels on the left of this listing represent the various components of the MATLAB structure associated with tipper.fis. You can access the various components of this structure by typing the component name after typing a. At the MATLAB command line, type

a.type

for example. MATLAB will respond with

ans =
mamdani

The function

getfis(a)

returns almost the same structure information that typing a, alone does.

getfis(a)returns

Name      = tipper
      Type      = mamdani
      NumInputs = 2
      InLabels  = 
            service
            food
      NumOutputs = 1
      OutLabels = 
            tip
      NumRules = 3
      AndMethod = min
      OrMethod = max
      ImpMethod = min
      AggMethod = max
      DefuzzMethod = centroid

Notice that some of these fields are not part of the structure, a. Thus, you cannot get information by typing a.Inlabels, but you can get it by typing

getfis(a,'Inlabels')

Similarly, you can obtain structure information using getfis in this manner.

getfis(a,'input',1)
getfis(a,'output',1)
getfis(a,'input',1,'mf',1)

The structure.field syntax also generates this information. For more information on the syntax for MATLAB structures and cell arrays, see the MATLAB documentation.

For example, type

a.input

or

a.input(1).mf(1)

The function getfis is loosely modeled on the Handle Graphics® function get. There is also a function called setfis that acts as the reciprocal to getfis. It allows you to change any property of an FIS. For example, if you wanted to change the name of this system, you could type

a = setfis(a,'name','gratuity');

However, since a is already a MATLAB structure, you can set this information more simply by typing

a.name = 'gratuity';

Now the FIS structure a has been changed to reflect the new name. If you want a little more insight into this FIS structure, try

showfis(a)

This returns a printout listing all the information about a. This function is intended more for debugging than anything else, but it shows all the information recorded in the FIS structure

Since the variable, a, designates the fuzzy tipping system, you can display any of the GUIs for the tipping system directly from the command line. Any of the following will display the tipping system with the associated GUI:

If, in addition, a is a Sugeno-type FIS, then anfisedit(a) will display the ANFIS Editor GUI.

Once any of these GUIs has been opened, you can access any of the other GUIs using the pull-down menu rather than the command line.


© 1994-2005 The MathWorks, Inc.