Main Content

showrule

Display fuzzy inference system rules

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 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 one of the following:

  • mamfis object — Mamdani fuzzy inference system

  • sugfis object — Sugeno fuzzy inference system

  • mamfistype2 object — Type-2 Mamdani fuzzy inference system (since R2019b)

  • sugfistype2 object — Type-2 Sugeno fuzzy inference system (since R2019b)

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

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

Version History

Introduced before R2006a

expand all

See Also

|