showrule
Display fuzzy inference system rules
Description
showrule(
displays rules using options specified by one or more fis
,Name,Value
)Name,Value
arguments.
Examples
Display All Rules for a Fuzzy Inference System
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 '
Select Fuzzy Rules to Display
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)'
Display Fuzzy Rules in German Language
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)'
Input Arguments
fis
— Fuzzy inference system
mamfis
object | sugfis
object | mamfistype2
object | sugfistype2
object
Fuzzy inference system, specified as one of the following:
mamfis
object — Mamdani fuzzy inference systemsugfis
object — Sugeno fuzzy inference systemmamfistype2
object — Type-2 Mamdani fuzzy inference systemsugfistype2
object — 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.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: showrule(fis,"Format","symbolic")
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: showrule(fis,Format="symbolic")
RuleIndex
— Rules to display
positive integer | vector of positive integers
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
.
Format
— Rule format
"verbose"
(default) | "symbolic"
| "indexed"
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
.
Language
— Rule language
"english"
(default) | "francais"
| "deutsch"
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 R2006aR2019b: Support for fuzzy inference system structures will be removed
Support 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.
R2017a: Specify options using name-value pair arguments
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 コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- 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)