To connect the two fuzzy trees in Matlab, you can use the output variable "IR1" from the first tree as one of the input variables for "IR2." Specifically, you would use "IR1" as the value for "input5" in "IR2."
Here's an example of how you can accomplish this:
Assuming you have already defined the fuzzy trees "IR1" and "IR2," you can access the output variable "IR1" using `IR1.output` and set it as the value for "input5" in "IR2" using the `addMF` function.
```matlab
% Define the new common tree
commonTree = addrule(IR2, 'if input5 is IR1 then output is ??');
Replace `[value_for_IR1]` with the desired value for "IR1" from the output of the first fuzzy tree, which will serve as the input for "input5" in the second fuzzy tree.
By creating the new common tree and setting the membership function for the common rule, you can then evaluate the common tree using the desired input values.
These FIS trees are also known as hierarchical fuzzy systems because the fuzzy systems are arranged in hierarchical tree structures. In a tree structure, the outputs of the low-level fuzzy systems are used as inputs to the high-level fuzzy systems.
MATLAB provides a Fuzzy Logic Toolbox that allows you to design and implement fuzzy logic systems. Here is a basic example of how to create a simple fuzzy inference system:
% Create a fuzzy inference system
fis = mamfis('Name', 'MyFuzzySystem');
% Define input variables
fis = addInput(fis, [0 10], 'Name', 'Input1');
fis = addInput(fis, [0 10], 'Name', 'Input2');
% Define output variable
fis = addOutput(fis, [0 100], 'Name', 'Output1');
% Define membership functions and rules
% (This is where you define your fuzzy logic rules and membership functions)