fistree
Network of connected fuzzy inference systems
Description
Use a fistree
object to represent a tree of interconnected fuzzy
inference systems.
Creation
Description
creates a network of interconnected fuzzy inference system objects, setting its fisTree
= fistree(fis
,connections
)FIS
and Connections
properties.
sets the fisTree
= fistree(___,Name,Value
)Name
or DisableStructuralChecks
property of the FIS tree using name-value arguments. Specify these arguments after the
arguments described in the previous syntax. For example,
fistree(__,"Name"="mytree")
sets the name of the FIS tree to
"mytree"
. You can specify both properties using two name-value
arguments.
Properties
Name
— FIS tree name
"fistreemodel"
(default) | string | character vector
Since R2021b
FIS tree name, specified as a string or character vector.
FIS
— Fuzzy inference systems
array
This property is read-only.
Fuzzy inference systems, specified as an array of FIS objects. You can specify any
combination of mamfis
, sugfis
, mamfistype2
, and
sugfistype2
objects. Each fuzzy inference system in the fis
array must have at
least one input and one output for fistree
construction. To
evaluate a fistree
, each fuzzy inference system must have at least
one rule.
Connections
— Connections between fuzzy inference systems
two-column string array
Connections between fuzzy inference systems, specified as a two-column string array. Each row represents a connection between two FIS objects. You can specify two types of connections.
Output-to-input connections — Specify a connection from the output of one FIS to the input of a different FIS.
Input-to-input connections — Specify a connection between two inputs so that they use the same input value.
To define a connection, specify the FIS name and variable name for both the source a
destination of the connection. For example, ["fisFrom/out1"
"fisTo/in1"]
defines a connection from output out1
of FIS
fisFrom
to input in1
of FIS
fisTo
.
The following figure demonstrates the different connection types using three FIS
objects, fis1
, fis2
, and
fis3
.
This FIS tree includes the following connections.
["fis1/output1" "fis3/input1"]
— Connection from outputoutput1
offis1
to inputinput1
offis3
["fis2/output1" "fis3/input2"]
— Connection from outputoutput1
offis2
to inputinput2
offis3
["fis1/input2" "fis2/input1"]
— Connection from inputinput2
offis1
to inputinput1
offis2
Connections must satisfy the following conditions:
A
fistree
object must have at least one FIS input without any incoming connection and one FIS output without any outgoing connection.A FIS input cannot have more than one incoming connection.
A FIS output can have more than one outgoing connection.
An input and output of the same FIS cannot be connected. In other words, you cannot create loops between connected FIS objects.
Symmetric connections between two inputs are not supported, For example,
["fis1/a" "fis2/b";"fis2/b" "fis1/a"]
is not supported. Instead, specify["fis1/a" "fis2/b"]
or["fis2/b" "fis1/a"]
.Self-input loops, such as
["fis1/a" "fis1/a"]
, are not supported.
Inputs
— Inputs to FIS tree
string array
This property is read-only.
Inputs to the FIS tree, specified as an array of strings. Inputs are automatically
determined using the specified connections of the fistree
object.
FIS inputs with no incoming connections are included in
Inputs
.
Update this property by updating the connections of the fistree
object.
Outputs
— Outputs of FIS tree
string array
Outputs of the FIS tree, specified as a string array. Outputs are automatically
determined using the specified connections of the fistree
object.
FIS outputs without any outgoing connections are included in
Outputs
.
You can update this property after initial construction of the
fistree
object. You can remove an existing input or add
additional intermediate outputs. Outputs
must contain at least one
output.
DisableStructuralChecks
— Option for disabling structural checks
false
(default) | true
Option for disabling structural checks when the FIS tree is updated after initial FIS creation, specified as one of the following values.
false
— Automatically update connections, inputs, and outputs. This option ensures that the FIS tree is always valid and can be evaluated.true
— Do not automatically update connections, inputs, and outputs. In this case, the resulting FIS tree can be in an invalid state, which can cause an error during evaluation.
Enable this option to improve computational efficiency when you programmatically construct a FIS tree.
Object Functions
evalfis | Evaluate fuzzy inference system |
plotfis | Display fuzzy inference system |
getTunableSettings | Obtain tunable settings from fuzzy inference system |
getTunableValues | Obtain values of tunable parameters from fuzzy inference system |
setTunableValues | Specify tunable parameter values of a fuzzy inference system |
Examples
Create Tree of Connected Fuzzy Inference Systems
Create a Mamdani fuzzy inference system and a Sugeno fuzzy inference system.
fis1 = mamfis('Name','fis1','NumInputs',2,'NumOutputs',1); fis2 = sugfis('Name','fis2','NumInputs',2,'NumOutputs',1);
Define a connection from the output of fis1
to the first input of fis2
.
con1 = ["fis1/output1" "fis2/input1"];
Create a FIS tree using the fuzzy inference systems and connection.
tree = fistree([fis1 fis2],con1);
Visualize the tree.
plotfis(tree)
Update Fuzzy Inference Systems in FIS Tree
Create a tree with two FISs and no connections.
fis1 = mamfis('Name','fis1','NumInputs',2,'NumOutputs',1); fis2 = mamfis('Name','fis2','NumInputs',2,'NumOutputs',1); fisT = fistree([fis1 fis2],[]);
Display the FIS tree configuration.
plotfis(fisT)
You can add a FIS to a FIS tree by appending a FIS object to the FIS property of the tree.
Add fis3
to the FIS tree.
fis3 = mamfis('Name','fis3','NumInputs',2,'NumOutputs',1); fisT.FIS(end+1) = fis3;
Connect the outputs of fis1
and fis2
to the inputs of fis3
.
fisT.Connections = [ "fis1/output1" "fis3/input1"; "fis2/output1" "fis3/input2"];
Display the updated FIS tree configuration.
plotfis(fisT)
Remove the first FIS (fis1
) from the FIS tree.
fisT.FIS(1) = [];
Display the updated FIS tree configuration.
plotfis(fisT)
The corresponding connection to the first input of fis3
is also removed.
Use Same Value for Multiple Inputs of FIS Tree
Create fis1
, fis2
, and fis3
, each with two inputs and one output.
fis1 = mamfis('Name','fis1','NumInputs',2,'NumOutputs',1); fis2 = mamfis('Name','fis2','NumInputs',2,'NumOutputs',1); fis3 = mamfis('Name','fis3','NumInputs',2,'NumOutputs',1);
Create a connection between output 1 of fis1
and input 1 of fis3
.
con1 = ["fis1/output1" "fis3/input1"];
Create a connection between output 1 of fis2
and input 2 of fis3
.
con2 = ["fis2/output1" "fis3/input2"];
Create a connection between input 2 of fis1
and input 1 of fis2
.
con3 = ["fis1/input2" "fis2/input1"];
Create and display the FIS tree.
fuzzTree = fistree([fis1 fis2 fis3],[con1;con2;con3]); plotfis(fuzzTree)
Display the inputs of the FIS tree. These inputs correspond to all free inputs that do not have an incoming connection.
fuzzTree.Inputs
ans = 3x1 string
"fis1/input1"
"fis1/input2"
"fis2/input2"
Evaluate the fuzzy tree. Specify values for input 1 of fis1
, input 2 of fis1
, and input 2 of fis2
. The value for input 2 of fis1
is also applied to input 1 of fis2
.
output = evalfis(fuzzTree,[0.8 0.25 0.7]);
Update FIS Tree Outputs
Create two FIS objects, each with two inputs and one output.
fis1 = mamfis('Name','fis1','NumInputs',2,'NumOutputs',1); fis2 = mamfis('Name','fis2','NumInputs',2,'NumOutputs',1);
Connect the output of fis1
to the second input of fis2
.
con = ["fis1/output1" "fis2/input2"];
Create the FIS tree.
fuzzTree = fistree([fis1 fis2],con);
Display outputs of the FIS tree. By default, the open FIS output from fis2
is an output of the FIS tree.
fuzzTree.Outputs
ans = "fis2/output1"
Visualize the FIS tree.
plotfis(fuzzTree,Legend="on")
Add the output of fis1
to the list of outputs.
fuzzTree.Outputs(end+1) = "fis1/output1";
Display the updated output list of the FIS tree.
fuzzTree.Outputs
ans = 2x1 string
"fis2/output1"
"fis1/output1"
Visualize the FIS tree. The added intermediate output is highlighted.
plotfis(fuzzTree,Legend="on")
Evaluate the FIS tree. The result contains the outputs from fis2
and fis1
.
evalfis(fuzzTree,[0.5 0.2 0.8])
ans = 1×2
0.1579 0.1579
Remove the first output from the list.
fuzzTree.Outputs(1) = [];
Display the updated output list of the FIS tree.
fuzzTree.Outputs
ans = "fis1/output1"
Visualize the FIS tree without the removed output. The visualization indicates that the output of fis2
is unused.
plotfis(fuzzTree,Legend="on")
Evaluate the FIS tree again. The result now contains the output of only fis2
.
evalfis(fuzzTree,[0.5 0.2 0.8])
ans = 0.1579
Create Incremental FIS Tree
This example shows the construction of an incremental FIS tree. For more information on the types of fuzzy tree structures, see FIS Trees.
Create fuzzy systems fis1
, fis2
, and fis3
, each with two inputs and one output.
fis1 = mamfis('Name','fis1','NumInputs',2,'NumOutputs',1); fis1.Inputs(1).Name = "color"; fis1.Inputs(2).Name = "doors"; fis2 = mamfis('Name','fis2','NumInputs',2,'NumOutputs',1); fis2.Inputs(2).Name = "power"; fis3 = mamfis('Name','fis3','NumInputs',2,'NumOutputs',1); fis3.Inputs(2).Name = "autopilot"; fis3.Outputs(1).Name = "prediction";
Create a connection between output 1 of fis1
and input 1 of fis2
.
con1 = ["fis1/output1" "fis2/input1"];
Create a connection between output 1 of fis2
and input 1 of fis3
.
con2 = ["fis2/output1" "fis3/input1"];
Create the FIS tree.
incTree = fistree([fis1 fis2 fis3],[con1;con2]);
Visualize the tree structure. At each level of the tree structure, an additional input is combined with the output of the previous level.
plotfis(incTree)
Create Aggregated FIS Tree
This example shows the construction of an aggregated FIS tree. For more information on the types of fuzzy tree structures, see FIS Trees.
Create fuzzy systems fis1
, fis2
, and fis3
, each with two inputs and one output.
fis1 = mamfis('Name','fis1','NumInputs',2,'NumOutputs',1); fis1.Inputs(1).Name = "dist_obs"; fis1.Inputs(2).Name = "angle_obs"; fis2 = mamfis('Name','fis2','NumInputs',2,'NumOutputs',1); fis2.Inputs(1).Name = "dist_tar"; fis2.Inputs(2).Name = "angle_tar"; fis3 = mamfis('Name','fis3','NumInputs',2,'NumOutputs',1); fis3.Outputs(1).Name = "heading_robot";
Create a connection between output 1 of fis1
and input 1 of fis3
.
con1 = ["fis1/output1" "fis3/input1"];
Create a connection between output 1 of fis2
and input 2 of fis3
.
con2 = ["fis2/output1" "fis3/input2"];
Create the FIS tree.
aggTree = fistree([fis1 fis2 fis3],[con1;con2]);
Visualize the tree structure.
plotfis(aggTree)
Create Cascaded FIS Tree
This example shows the construction of a cascaded FIS tree. For more information on the types of fuzzy tree structures, see FIS Trees.
Create fuzzy systems fis1
, fis2
, fis3
, and fis4
, each with two inputs and one output.
fis1 = mamfis('Name','fis1','NumInputs',2,'NumOutputs',1); fis1.Inputs(1).Name = "dist_obs"; fis1.Inputs(2).Name = "angle_obs"; fis2 = mamfis('Name','fis2','NumInputs',2,'NumOutputs',1); fis2.Inputs(1).Name = "dist_tar"; fis2.Inputs(2).Name = "angle_tar"; fis3 = mamfis('Name','fis3','NumInputs',2,'NumOutputs',1); fis4 = mamfis('Name','fis4','NumInputs',2,'NumOutputs',1); fis4.Inputs(2).Name = "preheading_robot"; fis4.Outputs(1).Name = "heading_robot";
Create a connection between output 1 of fis1
and input 1 of fis3
.
con1 = ["fis1/output1" "fis3/input1"];
Create a connection between output 1 of fis2
and input 2 of fis3
.
con2 = ["fis2/output1" "fis3/input2"];
Create a connection between output 1 of fis3
and input 1 of fis4
.
con3 = ["fis3/output1" "fis4/input1"];
Create the FIS tree.
casTree = fistree([fis1 fis2 fis3 fis4],[con1;con2;con3]);
Visualize the tree structure.
plotfis(casTree)
Create and Evaluate Parallel FIS Tree
This example shows the construction of a parallel FIS tree. For more information on the types of fuzzy tree structures, see FIS Trees.
Create fuzzy systems fis1
, fis2
, and fis3
, each with two inputs and one output.
fis1 = mamfis('Name','fis1','NumInputs',2,'NumOutputs',1); fis2 = mamfis('Name','fis2','NumInputs',2,'NumOutputs',1);
Create the FIS tree such that the FIS objects are in parallel; that is, the tree contains no interconnections and all the FIS outputs are FIS tree outputs.
parTree = fistree([fis1 fis2],[]);
Visualize the tree.
plotfis(parTree)
Evaluate the FIS tree.
output = evalfis(parTree,[0.1 0.3 0.8 0.4]);
Generate the final output by summing the FIS tree outputs.
finalOutput = sum(output);
Version History
Introduced in R2019aR2023b: Connections automatically update when FIS and variable names change
When you change the following names within a FIS tree object, the FIS tree connections now automatically update to use the new names.
Name of a component FIS object
Name of an input or output variable within a component FIS object
Previously, any connections containing the modified FIS or variable name were deleted from the FIS tree. You would then have to add the deleted connections back into the FIS tree.
R2021b: Name
property
To distinguish between FIS trees, you can now specify names for fistree
objects using the new Name
property.
See Also
mamfis
| sugfis
| mamfistype2
| sugfistype2
| tunefis
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.
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)