Main Content

FIS Tree

Evaluate fuzzy inference system tree

Since R2024a

  • FIS Tree block

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

expand all

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 and Service 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.

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 system

  • Adjusted 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

Ports

Input

expand all

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:

Output

expand all

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

expand all

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

Signal data type, specified as one of the following:

  • double — Double-precision signals

  • single — Single-precision signals

  • fixdt(1,16,0) — Fixed-point signals with binary point scaling

  • fixdt(1,16,2^0,0) — Fixed-point signals with slope and bias scaling

  • Expression — 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)"

Simulation mode, specified as one of the following:

  • Interpreted execution — Simulate fuzzy systems using precompiled MEX files for single and double 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

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"

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"

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