This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

showrule

Display fuzzy inference system rules

Syntax

showrule(fis)
showrule(fis,Name,Value)

Description

example

showrule(fis) displays the rules in the fuzzy inference system, fis.

example

showrule(fis,Name,Value) displays rules using options specified by one or more Name,Value pair arguments.

Examples

collapse all

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)'

Input Arguments

collapse all

Fuzzy inference system, specified as a mamfis or sugfis object.

Name-Value Pair Arguments

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.

Example: 'Format','symbolic' sets the rule display format to use language-neutral symbolic expressions.

Rules 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.

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 ComponentSymbol
    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 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 ComponentEnglishFrenchGerman
Start of antecedentifsiwenn
ANDandetund
ORorouoder
Start of consequent (implication)thenalorsdann
ISisestist
IS NOTis notn''est_pasist nicht

Compatibility Considerations

expand all

Not recommended starting in R2018b

See Also

|

Introduced before R2006a