showrule
Display fuzzy inference system rules
Description
showrule(
displays rules using options specified by one or more name-value arguments.fis
,Name=Value
)
Examples
Load fuzzy inference system.
fis = readfis("tipper");
Display rules using linguistic expressions.
showrule(fis)
ans = 3×78 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 = 3×65 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 = 3×15 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 = 2×78 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 = 3×85 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)'
Input Arguments
Fuzzy inference system, specified as one of these objects:
mamfis
— Mamdani fuzzy inference systemsugfis
— Sugeno fuzzy inference systemmamfistype2
— Type-2 Mamdani fuzzy inference systemsugfistype2
— Type-2 Sugeno fuzzy inference system
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: showrule(fis,Format="symbolic")
Rules to display, specified as one of the following values.
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
.
Rule format, specified as one of the following values.
"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
.
Rule language for "verbose"
format, specified as one of the following
values.
"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 |
Version History
Introduced before R2006aSupport for representing fuzzy inference systems as structures will be removed in a future
release. Use mamfis
and sugfis
objects with
this function instead. To convert existing fuzzy inference system structures to objects, use
the convertfis
function.
This change was announced in R2018b. Using fuzzy inference system structures with this function issues a warning starting in R2019b.
To specify options for viewing the rules of a fuzzy inference system, you now use name-value pair arguments. Any name-value pair arguments that you do not specify remain at their default values.
Previously, you specified options using optional input arguments
indexList
, format
, and
lang
.
showrule(fis,indexList,format,lang);
Starting in R2017a, modify your code to use one or more name-value pair arguments. For
example, view the first fuzzy rule in fis
.
showrule(fis,'RuleIndex',1);
The following table shows the mapping of the old input arguments to the new name-value pair arguments.
Old showrule Input Argument | New Name-Value Argument |
---|---|
indexList | 'RuleIndex' |
format | 'Format' |
lang | 'Language' |
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)