%% Use Same Value for Multiple Inputs of a FIS Tree
% Create fis1, fis2, and fis3, each with two inputs and one input.

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 the FIS tree.

fuzzTree = fistree([fis1 fis2 fis3],[con1;con2;con3]);

% Display the inputs of the FIS tree.

fuzzTree.Inputs

% 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 sent to input 1 of fis2.

output = evalfis(fuzzTree,[0.8 0.25 0.7]);

% Copyright 2018 The MathWorks, Inc.