Display fuzzy inference system rules
showrule(
displays
rules using options specified by one or more fis
,Name,Value
)Name,Value
pair
arguments.
Load fuzzy inference system.
fis = readfis('tipper');
Display rules using linguistic expressions.
showrule(fis)
ans = 3x78 char array
'1. If (service is poor) or (food is rancid) then (tip is cheap) (1) '
'2. If (service is good) then (tip is average) (1) '
'3. If (service is excellent) or (food is delicious) then (tip is generous) (1)'
Display rules using symbolic expressions.
showrule(fis,'Format','symbolic')
ans = 3x65 char array
'1. (service==poor) | (food==rancid) => (tip=cheap) (1) '
'2. (service==good) => (tip=average) (1) '
'3. (service==excellent) | (food==delicious) => (tip=generous) (1)'
Display rules using membership function indices.
showrule(fis,'Format','indexed')
ans = 3x15 char array
'1 1, 1 (1) : 2 '
'2 0, 2 (1) : 1 '
'3 2, 3 (1) : 2 '
Load fuzzy inference system.
fis = readfis('tipper');
Display the first and third rules.
showrule(fis,'RuleIndex',[1 3])
ans = 2x78 char array
'1. If (service is poor) or (food is rancid) then (tip is cheap) (1) '
'3. If (service is excellent) or (food is delicious) then (tip is generous) (1)'
Load fuzzy inference system.
fis = readfis('tipper');
Display the rules in German using the 'deutsch'
language.
showrule(fis,'Language','deutsch')
ans = 3x85 char array
'1. Wenn (service ist poor) oder (food ist rancid) dann (tip ist cheap) (1) '
'2. Wenn (service ist good) dann (tip ist average) (1) '
'3. Wenn (service ist excellent) oder (food ist delicious) dann (tip ist generous) (1)'
fis
— Fuzzy inference systemmamfis
object | sugfis
object | mamfistype2
object | sugfistype2
objectFuzzy inference system, specified as one of the following:
mamfis
object — Mamdani fuzzy inference system
sugfis
object — Sugeno fuzzy inference system
mamfistype2
object — Type-2 Mamdani fuzzy inference system
sugfistype2
object — Type-2 Sugeno fuzzy inference system
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
'Format','symbolic'
sets the rule display format to use
language-neutral symbolic expressions.'RuleIndex'
— Rules to displayRules to display, specified as the comma-separated pair consisting
of 'RuleIndex'
and one of the following:
Positive integer — Index of a single rule to display
Vector of positive integers — Indices of multiple rules to display
The default vector includes the indices for all the rules in fis
.
'Format'
— Rule format'verbose'
(default) | 'symbolic'
| 'indexed'
Rule format, specified as the comma-separated pair consisting
of 'Format'
and one of the following:
'verbose'
— Use linguistic expressions.
'If (service is poor) or (food is rancid) then (tip is cheap) (1)'
The rule weight is displayed in parentheses at the end of the rule.
You can specify the rule language using the Language
option.
'symbolic'
— Use language-neutral symbolic
expressions.
'(service==poor) | (food==rancid) => (tip=cheap) (1)'
The symbolic rules use the following symbols.
Rule Component | Symbol |
---|---|
AND | & |
OR | | |
IS (in antecedent) | == |
IS (in consequent) | = |
IS NOT | ~= |
Implication (then) | => |
The rule weight is displayed in parentheses at the end of the rule.
'indexed'
— Use input and output membership function (MF)
indices and integer representation of fuzzy operators.
The indexed rules display in the following format:
'<input MFs>, <output MFs>, (<weight>) : <logical operator - 1 (AND), 2 (OR)>'
For example:
'1 1, 1 (1) : 2'
To indicate NOT operations for input and output membership functions, the
software uses negative indices. For example, to indicate "not the second
membership function," the software uses -2
.
To indicate a don’t care condition for an input or output membership function,
the software uses 0
.
'Language'
— Rule language'english'
(default) | 'francais'
| 'deutsch'
Rule language for 'verbose'
format, specified
as the comma-separated pair consisting of 'Language'
and
one of the following:
'english'
— Display rules in English.
'If (service is poor) or (food is rancid) then (tip is cheap) (1)'
'francais'
— Display rules in French.
'Si (service est poor) ou (food est rancid) alors (tip est cheap) (1)'
'deutsch'
— Display rules in German.
'Wenn (service ist poor) oder (food ist rancid) dann (tip ist cheap) (1)'
The software displays the FIS rules using the following keywords.
Rule Component | English | French | German |
---|---|---|---|
Start of antecedent | if | si | wenn |
AND | and | et | und |
OR | or | ou | oder |
Start of consequent (implication) | then | alors | dann |
IS | is | est | ist |
IS NOT | is not | n''est_pas | ist nicht |
Warns starting in R2019b
Support for representing fuzzy inference systems as structures will be removed in a future
release. Use mamfis
and
sugfis
objects
instead. There are differences between these representations that require updates to your
code. These differences include:
Object property names that differ from the corresponding structure fields.
Objects store text data as strings rather than as character vectors.
Also, all Fuzzy Logic
Toolbox™ functions that accepted or returned fuzzy inference systems as structures now
accept and return either mamfis
or sugfis
objects.
To convert existing fuzzy inference system structures to objects, use the convertfis
function.
You have a modified version of this example. Do you want to open this example with your edits?