1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>Octave Fuzzy Logic Toolkit: addrule</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ==" crossorigin="anonymous" referrerpolicy="no-referrer">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script>
<script type="text/javascript" async
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML">
</script>
<style>
var {
font-style: italics;
font-weight: bold;
}
td {
vertical-align: top;
}
</style>
</head>
<body>
<div class="bg-dark">
<div class="container-xl">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href=index.html>
<img src="assets/fuzzy-logic-toolkit.png" alt="fuzzy-logic-toolkit" class="d-inline-block align-top" width="25" height="25">
Octave Fuzzy Logic Toolkit
</a>
<button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="index.html#Command-Line Creation and Modification of Fuzzy Inference Systems">
<i class="fas fa-list-alt"></i>
Command-Line Creation and Modification of Fuzzy Inference Systems
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://gnu-octave.github.io/packages/">
<img src="assets/octave-logo.svg" alt="GNU Octave logo" class="d-inline-block align-top" width="25" height="25">
Octave Packages
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.octave.org">
<i class="fas fa-home"></i>
GNU Octave website
</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
</div>
<div class="container-xl my-4">
<div class="card rounded">
<div class="card-header card-header-mod">
<div class="row d-flex flex-wrap align-items-center">
<div class="col-sm-3 col-md-5 mb-2 mb-sm-0">
<h3 class="d-inline-block mr-2">
Function Reference: <b><code>addrule</code></b>
</h3>
</div>
</div>
</div>
<div class="card-body">
<dl>
<dt><u>Function File:</u> <var>fis</var> = <b>addrule</b><i> (<var>fis</var>, <var>rule_matrix</var>)</i></dt>
</dl>
<p> Add a list of rules to an existing FIS structure and return
the updated FIS.
</p>
<div class="ms-5">
<p> Each row of the <var>rule_matrix</var> represents one rule and has the form:
</p>
<pre class="verbatim"> [in1_mf ... inM_mf out1_mf ... outN_mf weight connect]
</pre>
<p> where:
</p>
<table>
<thead><tr><th width="25%">Element in Rule Vector</th><th width="70%">Expected Type or Value</th></tr></thead>
<tr><td width="25%">in<i>_mf</td><td width="70%">membership function index for input i</td></tr>
<tr><td width="25%">out<j>_mf</td><td width="70%">membership function index for output j</td></tr>
<tr><td width="25%">weight</td><td width="70%">relative weight of the rule (0 <= weight <= 1)</td></tr>
<tr><td width="25%">connect</td><td width="70%">antecedent connective (1 == and; 2 == or)</td></tr>
<tr><td width="25%"> </td><td width="70%"> </td></tr>
<thead><tr><th width="25%">Hedge String</th><th width="70%">Effect of Applying Hedge</th></tr></thead>
<tr><td width="25%">"not"</td><td width="70%">prepend a minus sign to the membership function index</td></tr>
<tr><td width="25%">"somewhat"</td><td width="70%">append ".05" to the membership function index</td></tr>
<tr><td width="25%">"very"</td><td width="70%">append ".20" to the membership function index</td></tr>
<tr><td width="25%">"extremely"</td><td width="70%">append ".30" to the membership function index</td></tr>
<tr><td width="25%">"very very"</td><td width="70%">append ".40" to the membership function index</td></tr>
<tr><td width="25%">custom hedge</td><td width="70%">append .xy, where x.y is the degree to which the membership
value should be raised, to the membership function index</td></tr>
</table>
<br>
<p> To omit an input or output, use 0 for the membership function index.
The consequent connective is always "and".
</p>
<p> For example, to express:
</p>
<pre class="verbatim"> "If (input_1 is mf_2) or (input_3 is not mf_1) or (input_4 is very mf_1),
then (output_1 is mf_2) and (output_2 is mf_1^0.3)."
</pre>
<p> with weight 1, the corresponding row of <var>rule_matrix</var> would be:
</p>
<pre class="verbatim"> [2 0 -1 4.2 2 1.03 1 2]
</pre>
<p> For a complete example that uses addrule, see heart_disease_demo_1.m.
</p>
<p> <strong>See also: </strong>
<a href="heart_disease_demo_1.html">heart_disease_demo_1</a>,
<a href="showrule.html">showrule</a>
</p>
</div>
</div>
</div>
</div>
</body>
</html>
|