Main Content

getTunableSettings

Obtain tunable settings from fuzzy inference system

Description

in = getTunableSettings(fis) returns tunable settings of input variables of the fuzzy system fis.

[~,out] = getTunableSettings(fis) returns tunable settings of output variables of the fuzzy system fis.

[~,~,rule] = getTunableSettings(fis) returns tunable settings of rules of the fuzzy system fis.

[in,out,rule] = getTunableSettings(fis) returns tunable settings of inputs, outputs, and rules of the fuzzy system fis.

example

[___] = getTunableSettings(fis,Name=Value) specifies tunable setting information using name-value pair arguments. You can specify multiple name-value pairs.

example

Examples

collapse all

Create a fuzzy inference system.

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

Obtain the tunable settings of the inputs, outputs, and rules of the fuzzy inference system.

[in,out,rule] = getTunableSettings(fis1);

You can use dot notation to specify tunable settings.

For the first membership function of input 1:

  • Do not tune parameter 1.

  • Set the minimum ranges of the last two parameters to 0.

  • Set the maximum ranges of the last two parameters to 1.

in(1).MembershipFunctions(1).Parameters.Free(1) = false;
in(1).MembershipFunctions(1).Parameters.Minimum(2:end) = 0;
in(1).MembershipFunctions(1).Parameters.Maximum(2:end) = 1;

For the first rule:

  • Set the input 1 membership function index as nontunable.

  • Allow NOT logic for input 2 membership function index.

  • Do not ignore the output 1 membership function index.

rule(1).Antecedent.Free(1) = false;
rule(1).Antecedent.AllowNot(2) = true;
rule(1).Consequent.AllowEmpty(1) = false;

Create a fuzzy inference system.

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

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

[in,out] = getTunableSettings(fis1);

You can use dot notation to specify the tunable settings of input and output variables.

For the first membership function of input 1, set the first and third parameters to tunable.

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

For the first membership function of input 2, set the minimum parameter range to 0.

in(2).MembershipFunctions(1).Parameters.Minimum = 0;

For the first membership function of the output variable, set the maximum parameter range to 1.

out(1).MembershipFunctions(1).Parameters.Maximum = 1;

Create a fuzzy inference system.

fis = mamfis("Name","fis1","NumInputs",2,"NumOutputs",1);

Obtain rule parameter settings from the FIS.

[~,~,rule] = getTunableSettings(fis);

Each rule parameter setting includes the FIS name, the index of the rule in the FIS, and parameter settings for the rule antecedent and consequent (the rule clauses). For each clause, you can specify the tunability settings.

View the default tunable settings for the antecedent of the first rule.

rule(1).Antecedent(1)
ans = 
  ClauseParameters with properties:

      AllowNot: [0 0]
    AllowEmpty: [1 1]
          Free: [1 1]

You can use dot notation to specify the tunable settings for each rule.

Allow NOT logic in the antecedent of rule 1.

rule(1).Antecedent.AllowNot = true;

Make the consequent of rule 2 not available for tuning.

rule(2).Consequent.Free = 0;

Do not allow absence of a variable in the consequent of rule 3.

rule(3).Consequent.AllowEmpty = false;

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;

By default, the tunable settings for a type-2 FIS produce symmetric lag results in the tuned system. To allow for asymmetric lag results, specify the AsymmetricLag name-value argument.

[in2,out2] = getTunableSettings(fis,'AsymmetricLag',true);

Create a fuzzy inference system, and define the tunable parameter settings of inputs, outputs, and rules.

Create a FIS, and obtain its tunable settings.

fis = mamfis("NumInputs",2,"NumOutputs",2);
[in,out,rule] = getTunableSettings(fis);

You can specify all the input variables, output variables, or rules as tunable or nontunable. For example, set all the output variable settings as nontunable.

out = setTunable(out,0);

You can set the tunability of individual variables or rules. For example, set the first input variable as nontunable.

in(1) = setTunable(in(1),0);

You can set individual membership functions as nontunable. For example, set the first membership function of input 2 as nontunable.

in(2).MembershipFunctions(1) = setTunable(in(2).MembershipFunctions(1),0);

You can also specify the tunability of a subset of variables or rules. For example, set the first two rules as nontunable.

rule(1:2) = setTunable(rule(1:2),0);

Since R2023a

Create a FIS tree that contains three FIS objects.

fis1 = mamfis(Name="fis1",NumInputs=2,NumOutputs=1);
fis2 = mamfis(Name="fis2",NumInputs=2,NumOutputs=1);
fis3 = mamfis(Name="fis3",NumInputs=2,NumOutputs=1);

connections = [
    "fis1/output1" "fis3/input1";
    "fis2/output1" "fis3/input2"];

fisT = fistree([fis1 fis2 fis3],connections);

You can obtain the tunable settings for all of the FIS objects in a FIS tree or any subset of FIS objects.

Obtain the tunable settings for all FIS objects in fisT.

[in,out,rule] =  getTunableSettings(fisT);

The settings objects in, out, and rule contain variable and rule tunability settings for all FIS objects sorted alphabetically by FIS name.

Obtain the tunable settings for the variables and rules in fis3.

[in3,out3,rule3] = getTunableSettings(fisT,FIS="fis3");

You can also obtain tunable settings for multiple FIS objects in a FIS tree. Obtain the tunable settings for the rules in fis1 and fis2.

[~,~,rule12] = getTunableSettings(fisT,FIS=["fis1" "fis2"]);

When you specify tunable settings for a subset of the FIS objects in a FIS tree, the tunefis function treats the remaining FIS objects as nontunable.

Input Arguments

collapse all

Fuzzy inference system, specified as one of the following:

  • mamfis object — Mamdani fuzzy inference system

  • sugfis object — Sugeno fuzzy inference system

  • mamfistype2 object — Type-2 Mamdani fuzzy inference system

  • sugfistype2 object — Type-2 Sugeno fuzzy inference system

  • fistree object — Tree of interconnected fuzzy inference systems (since R2023a)

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: FIS="fis1"

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: "AsymmetricLag",true

Since R2023a

Names of component FIS objects from FIS tree, specified as a string or string array. When you specify this argument, in, out, and rule contain the tunable settings for the variables and rules that apply to the specified component FIS objects.

This argument is supported when fis is a fistree object.

Option to use asymmetric lag when tuning the membership functions of a type-2 FIS.

This argument is supported when fis is a:

  • mamfistype2 or sugfistype2 object

  • fistree with at least one component FIS that is a mamfistype2 or sugfistype2 object.

Output Arguments

collapse all

Tunable settings for input variables, returned as an array of VariableSettings objects. Each VariableSettings object contains tunability settings for the input variable indicated by its FISName and VariableName properties.

Specify the tunability settings of the membership functions for this variable, using its MembershipFunctions property.

Tunable settings for input variables, returned as an array of VariableSettings objects. Each VariableSettings object contains tunability settings for the output variable indicated by its FISName and VariableName properties.

Specify the tunability settings of the membership functions for this variable, using its MembershipFunctions property.

Tunable settings for rules, returned as an array of RuleSettings object. Each RuleSettings object contains tunability settings for a rule from the FIS indicated by its FISName property.

Specify the tunability settings of the antecedent and consequent for this variable, using its Antecedent and Consequent properties, respectively.

Version History

Introduced in R2019a

expand all