FIS Tree
Libraries:
Fuzzy Logic Toolbox
Description
The FIS Tree block implements a tree of fuzzy inference systems (FISs) in Simulink®. You specify the FIS tree to evaluate using the FIS tree name parameter.
For more information on FIS trees, see FIS Trees.
Examples
Simulate FIS Tree
The simulateWeightedTipper
model computes weighted tip values for specified food and service ratings using the FIS Tree block, which is configured to use the FIS tree stored in the weightedTipper.mat
file. For more information on how to create this FIS tree, see Build FIS Tree Using Fuzzy Logic Designer.
load weightedTipper; model = "simulateWeightedTipper"; open_system(model)
In this model:
You specify food and service ratings in the range [0,10] using the
Food Rating
andService Rating
blocks, respectively.You specify the relative importance of each rating using the
Weight
block. Specify a weight factor in the range [0,1], where a lower value places more importance on the food rating and a higher value places more importance on the service rating.The input signals are constrained to their respective input ranges.
The constrained input signals are combined using a Mux block.
The FIS Tree block computes the tip output value based on the input signals.
Access Intermediate Outputs of FIS Tree
When you simulate a FIS tree, you can configure the fistree
object to output the intermediate inference results from its component FIS objects.
This example modifies the weightedTipper
FIS tree to output the adjusted food and service ratings from the first layer of FIS tree objects. For more information on how to create the weightedTipper
FIS tree, see Build FIS Tree Using Fuzzy Logic Designer.
load weightedTipper;
Copy the FIS tree and configure it to have three outputs:
Calculated tip
Adjusted food rating output by the
foodFIS
systemAdjusted service rating output by the
serviceFIS
system
intermediateTipper = weightedTipper; intermediateTipper.Name = "intermediateTipper"; intermediateTipper.Outputs = ... ["tipFIS/tip" "foodFIS/rating" "serviceFIS/rating"];
The intermediateFISTree
model includes a FIS Tree block configured to simulate the intermediateTipper
FIS tree. It splits the signal from the output port using a Demux block.
model = "intermediateFISTree";
open_system(model)
You can adjust the signals and simulate the model to see the resulting tip and intermediate ratings.
In the preceding figure, the food has a high rating and the service has a low rating. However, the weight factor of 0.2 places more importance on the service rating. Therefore, the resulting tip is low.
The Food Modified Rating
block shows that the foodFIS
system within the FIS tree adjusts the food rating to be closer to 5. Such a rating means that the food quality has a smaller impact on the tip.
Extended Examples
Design Controller for Artificial Pancreas Using Fuzzy Logic
Design and tune a FIS tree to control insulin infusion for type-1 diabetes.
Ports
Input
in — Input signal
scalar | vector
For a single-input FIS tree, the input is a scalar signal. For a multi-input FIS tree, combine the inputs into a vector signal using blocks such as:
Mux (Simulink)
Vector Concatenate (Simulink)
Bus Creator (Simulink)
Output
out — Defuzzified output signal
scalar | vector
For a single-output FIS tree, the output is a scalar signal. For a multi-output FIS tree, the output is a vector signal. To split system outputs into scalar signals, use the Demux (Simulink) block.
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
General
FIS tree name — FIS tree to evaluate
fistree
object | MAT file name in quotes
FIS tree to evaluate, specified as one of the following:
fistree
object in the MATLAB® workspace.Name of a MAT file (
*.mat
) in the current working folder or on the MATLAB path. The MAT file must contain only one FIS object. Including the file extension in the file name is optional. Specify the filename in quotes.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
(Simulink) function.
Parameter: | FIS |
Values: | '"weightedTipper"' (default) | variable name in quotes | file name in quotes |
Number of samples for output discretization — Number of points in output fuzzy sets
101 (default) | integer greater than 1
Number of samples for discretizing the range of FIS output variables, specified as an integer greater than 1
. This value corresponds to the number of points in the output fuzzy set for each rule.
To reduce memory usage while evaluating Mamdani FISs, specify a lower number of samples. Doing so sacrifices the accuracy of the defuzzified output value. Specifying a low number of samples can make the output area for defuzzification zero. In this case, the defuzzified output value is the midpoint of the output variable range.
Note
The block ignores this parameter when evaluating Sugeno FISs.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
(Simulink) function.
Parameter: | OutputSampleNumber |
Values: | "101" (default) | integer greater than 1 in quotes |
Data type — Signal data type
double
(default) | single
| fixed-point
| expression
Signal data type, specified as one of the following:
double
— Double-precision signalssingle
— Single-precision signalsfixdt(1,16,0)
— Fixed-point signals with binary point scalingfixdt(1,16,2^0,0)
— Fixed-point signals with slope and bias scalingExpression — Expression that evaluates to one of these data types
For fixed-point data types, you can configure the signedness, word length, and scaling parameters using the Data Type Assistant. For more information, see Specifying a Fixed-Point Data Type (Simulink).
Programmatic Use
To set the block parameter value programmatically, use
the set_param
(Simulink) function.
Parameter: | DataType |
Values: | "double" (default) | "single" | "fixdt(1,16,0)" | "fixdt(1,16,2^0,0)" |
Simulate using — Simulation mode
Interpreted execution
(default) | Code generation
Simulation mode, specified as one of the following:
Interpreted execution
— Simulate fuzzy systems using precompiled MEX files forsingle
anddouble
data types. Using this option reduces the initial compilation time of the model.Code generation
— Simulate fuzzy system without precompiled MEX files. Use this option when simulating fuzzy systems for code generation applications.
For fixed-point data types, the FIS Tree block always simulates using Code generation
mode.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
(Simulink) function.
Parameter: | SimulateUsing |
Values: | "Interpreted execution" (default) | "Code generation" |
Diagnostics
Out of range input value — Diagnostic message behavior when an input is out of range
warning
(default) | error
| none
Diagnostic message behavior when an input is out of range, specified as one of the following:
warning
— Report the diagnostic message as a warning.error
— Report the diagnostic message as an error.none
— Do not report the diagnostic message.
When an input value is out of range, corresponding rules in the fuzzy system can have unexpected firing strengths.
Dependencies
Diagnostic messages are provided only when the Simulate using parameter is
Interpreted execution
.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
(Simulink) function.
Parameter: | OutOfRangeInputValueMessage |
Values: | "warning" (default) | "error" | "none" |
No rule fired — Diagnostic message behavior when no rules fire
warning
(default) | error
| none
Diagnostic message behavior when no rules fire for a given output variable, specified as one of the following:
warning
— Report the diagnostic message as a warning.error
— Report the diagnostic message as an error.none
— Do not report the diagnostic message.
When No rule fired is warning
or none
and no rules fire for a given output, the defuzzified output value is set to its mean range value.
Dependencies
Diagnostic messages are provided only when the Simulate using parameter is
Interpreted execution
.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
(Simulink) function.
Parameter: | NoRuleFiredMessage |
Values: | "warning" (default) | "error" | "none" |
Empty output fuzzy set — Diagnostic message behavior when an output fuzzy set is empty
warning
(default) | error
| none
Diagnostic message behavior when an output fuzzy set is empty, specified as one of the following:
warning
— Report the diagnostic message as a warning.error
— Report the diagnostic message as an error.none
— Do not report the diagnostic message.
When Empty output fuzzy set is warning
or none
and an output fuzzy set is empty, the defuzzified value for the corresponding output is set to its mean range value.
Dependencies
This diagnostic message applies to Mamdani systems only.
Diagnostic messages are provided only when the Simulate using parameter is
Interpreted execution
.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
(Simulink) function.
Parameter: | EmptyOutputFuzzySetMessage |
Values: | "warning" (default) | "error" | "none" |
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.
Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.
Version History
Introduced in R2024a
See Also
Blocks
Apps
Functions
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)