Main Content

mamfistype2

Interval type-2 Mamdani fuzzy inference system

Since R2019b

Description

Use a mamfistype2 object to represent an interval type-2 Mamdani fuzzy inference system (FIS).

As an alternative to a type-2 Mamdani system, you can create a:

  • Type-2 Sugeno system using a sugfistype2 object

  • Type-1 Mamdani system using a mamfis object

  • Type-1 Sugeno system using a sugfis object

For more information on the different types of fuzzy inference systems, see Mamdani and Sugeno Fuzzy Inference Systems and Type-2 Fuzzy Inference Systems.

Creation

To create a type-2 Mamdani FIS object, use one of the following methods:

  • The mamfistype2 function.

  • If you have input and output training data, you can create a type-1 FIS using the genfis function with the FCM clustering method. You can then convert this FIS to a type-2 system using convertToType2.

    opt = genfisOptions('FCMClustering','FISType','mamdani');
    fis1 = genfis(inputData,outputData,opt);
    fis = convertToType2(fis1);
  • If you have a FIS file (*.fis) for a type-2 Mamdani system, you can use the readfis function.

Description

example

fis = mamfistype2 creates a type-2 Mamdani FIS with default property values. To modify the properties of the fuzzy system, use dot notation.

example

fis = mamfistype2(Name,Value) specifies FIS configuration information or sets object properties using name-value pair arguments. You can specify multiple name-value pairs. Enclose names in quotes.

Input Arguments

expand all

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.

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

Example: 'NumInputs',2 configures the fuzzy system to have two input variables

Number of FIS inputs, specified as a nonnegative integer.

Number of membership functions for each FIS input, specified as a positive integer.

Number of FIS outputs, specified as a nonnegative integer.

Number of membership functions for each FIS output, specified as a positive integer.

Membership function type for both input and output variables, specified as either "trimf" (triangular MF) or "gaussmf" (Gaussian MF). For each input and output variable, the membership functions are uniformly distributed over the variable range with approximately 80% overlap in the MF supports.

Option for automatically adding rules, specified as one of the following:

  • "allcombinations" — If both NumInputs and NumOutputs are greater than zero, create rules with antecedents that contain all input membership function combinations. Each rule consequent contains all the output variables and uses the first membership function of each output.

  • "none" — Create a FIS without any rules.

Properties

expand all

FIS name, specified as a string or character vector.

AND operator method for combining fuzzified input values in a fuzzy rule antecedent, specified as one of the following:

  • "min" — Minimum of fuzzified input values

  • "prod" — Product of fuzzified input values

  • String or character vector — Name of a custom AND function in the current working folder or on the MATLAB® path

  • Function handle — Custom AND function in the current working folder or on the MATLAB path

For more information on using custom functions, see Build Fuzzy Systems Using Custom Functions.

For more information on fuzzy operators and the fuzzy inference process, see Fuzzy Inference Process.

OR operator method for combining fuzzified input values in a fuzzy rule antecedent, specified as one of the following:

  • "max" — Maximum of fuzzified input values.

  • "probor" — Probabilistic OR of fuzzified input values. For more information, see probor.

  • String or character vector — Name of a custom OR function in the current working folder or on the MATLAB path.

  • Function handle — Custom OR function in the current working folder or on the MATLAB path.

For more information on using custom functions, see Build Fuzzy Systems Using Custom Functions.

For more information on fuzzy operators and the fuzzy inference process, see Fuzzy Inference Process.

Implication method for computing the consequent fuzzy set, specified as one of the following:

  • "min" — Truncate the consequent membership function at the antecedent result value.

  • "prod" — Scale the consequent membership function by the antecedent result value.

  • String or character vector — Name of a custom implication function in the current working folder or on the MATLAB path.

  • Function handle — Custom implication function in the current working folder or on the MATLAB path.

For more information on using custom functions, see Build Fuzzy Systems Using Custom Functions.

For more information on implication and the fuzzy inference process, see Fuzzy Inference Process.

Aggregation method for combining rule consequents, specified as one of the following:

  • "max" — Maximum of consequent fuzzy sets

  • "sum" — Sum of consequent fuzzy sets

  • "probor" — Probabilistic OR of consequent fuzzy sets. For more information, see probor.

  • String or character vector — Name of a custom aggregation function in the current working folder or on the MATLAB path

  • Function handle — Custom aggregation function in the current working folder or on the MATLAB path

For more information on using custom functions, see Build Fuzzy Systems Using Custom Functions.

For more information on aggregation and the fuzzy inference process, see Fuzzy Inference Process.

Defuzzification method for computing crisp output values from the aggregated output fuzzy set. Type-2 Mamdani systems support only centroid defuzzification.

Option to disabling consistency checks when property values change, specified as a logical value.

By default, when you change the value of a property of a mamfistype2 object, the software verifies whether the new property value is consistent with the other object properties. These checks can affect performance, particularly when creating and updating fuzzy systems within loops.

To disable these checks, which results in faster FIS construction, set DisableStructuralChecks to true.

Note

Disabling structural checks can result in an invalid mamfistype2 object.

To reenable the consistency checks, first verify that the changes you made to the FIS are consistent and produce a valid mamfistype2 object. Then, set DisableStructuralChecks to false. If the mamfistype2 object is invalid, reenabling the consistency checks generates an error.

FIS input variables, specified as a vector of fisvar objects. To add and remove input variables, use addInput and removeInput, respectively.

You can also create a vector of fisvar objects and assign it to Inputs using dot notation.

You can add membership functions to input variables using the addMF function.

FIS output variables, specified as a vector of fisvar objects. To add and remove output variables, use addOutput and removeOutput, respectively.

You can also create a vector of fisvar objects and assign it to Outputs using dot notation.

You can add membership functions to output variables using the addMF function.

FIS input variables, specified as a vector of fisrule objects. To add fuzzy rules, use the addRule function.

You can also create a vector of fisrule objects and assign it to Rules using dot notation.

To remove a rule, set the corresponding rule vector element to []. For example, to remove the tenth rule from the rule list, type:

fis.Rules(10) = [];

Type-reduction method for converting a type-2 output fuzzy set to an interval type-1 fuzzy set, specified as one of the following:

  • "karnikmendel" — Karnik-Mendel

  • "ekm" — Enhanced Karnik-Mendel

  • "iasc" — Iterative algorithm with stop condition

  • "eiasc" — Enhanced iterative algorithm

  • String — Name of a custom type-reduction function in the current working directory or on the MATLAB path.

  • Function handle — Function handle to a custom type-reduction function in the current working folder or on the MATLAB path.

For more information on type reduction, see Type-2 Fuzzy Inference Systems.

Object Functions

addInputAdd input variable to fuzzy inference system
removeInputRemove input variable from fuzzy inference system
addOutputAdd output variable to fuzzy inference system
removeOutputRemove output variable from fuzzy inference system
addRuleAdd rule to fuzzy inference system
addMFAdd membership function to fuzzy variable
removeMFRemove membership function from fuzzy variable
evalfisEvaluate fuzzy inference system
writeFISSave fuzzy inference system to file
convertToType1Convert type-2 fuzzy inference system into type-1 fuzzy inference system

Examples

collapse all

Create a type-2 Mamdani fuzzy inference system with default property values.

fis = mamfistype2;

Modify the system properties using dot notation. For example, set the type reduction method to use the enhanced Karnik-Mendel method.

fis.TypeReductionMethod = "ekm";

Alternatively, you can specify one of more FIS properties when you create a fuzzy system.

fis = mamfistype2('TypeReductionMethod',"ekm");

Create a type-2 Mamdani fuzzy inference system with three inputs and one output.

fis = mamfis("NumInputs",3,"NumOutputs",1)
fis = 
  mamfis with properties:

                       Name: "fis"
                  AndMethod: "min"
                   OrMethod: "max"
          ImplicationMethod: "min"
          AggregationMethod: "max"
      DefuzzificationMethod: "centroid"
    DisableStructuralChecks: 0
                     Inputs: [1x3 fisvar]
                    Outputs: [1x1 fisvar]
                      Rules: [1x27 fisrule]

	See 'getTunableSettings' method for parameter optimization.

By default, the software creates a rule for each possible input combination.

Alternative Functionality

App

You can interactively create a type-2 Mamdani FIS using the Fuzzy Logic Designer app. You can then export the system to the MATLAB workspace.

Version History

Introduced in R2019b