%% Obtain Tunable Settings of Input and Output Variables from Type-2 FIS
% Create a type-2 fuzzy inference system.

fis = mamfistype2('Name','fis1','NumInputs',2,'NumOutputs',1);

% Obtain the tunable settings of the input and output variables of the fuzzy inference system.

[in,out] = getTunableSettings(fis);

% You can use dot notation to specify the tunable settings of the membership functions of the input and output variables.
% For the first membership function of input 1, set the first and third upper membership function parameters as tunable.

in(1).MembershipFunctions(1).UpperParameters.Free = [1 0 1];

% For the first membership function of input 2, set the tunable range of the lower membership function scale to be between 0.7 and 0.9.

in(2).MembershipFunctions(1).LowerScale.Minimum = 0.7;
in(2).MembershipFunctions(1).LowerScale.Maximum = 0.9;

% For the first membership function of output 1, set the tunable range of the lower membership function lag to be between 0.1 and 0.4.

in(2).MembershipFunctions(1).LowerLag.Minimum = 0.1;
in(2).MembershipFunctions(1).LowerLag.Maximum = 0.4;

% Copyright 2019 The MathWorks, Inc.