Fuzzy Logic Toolbox | ![]() ![]() |
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 = 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
for example. MATLAB will respond with
returns almost the same structure information that typing a
, alone does.
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
Similarly, you can obtain structure information using getfis
in this manner.
The structure.field
syntax also generates this information. For more information on the syntax for MATLAB structures and cell arrays, see the MATLAB documentation.
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
However, since a
is already a MATLAB structure, you can set this information more simply by typing
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
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.
fuzzy(a)
displays
the FIS Editor.
mfedit(a)
displays the
Membership Function Editor.
ruleedit(a)
displays the
Rule Editor.
ruleview(a)
displays
the
Rule Viewer.
surfview(a)
displays
the Surface Viewer.
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.
![]() | Customizing Your Fuzzy System | System Display Functions | ![]() |