mamfis
Mamdani fuzzy inference system
Description
Use a mamfis object to represent a type-1 Mamdani fuzzy
inference system (FIS).
As an alternative to a type-1 Mamdani system, you can create a:
Type-1 Sugeno system using a
sugfisobjectType-2 Mamdani system using a
mamfistype2objectType-2 Sugeno system using a
sugfistype2object
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 Mamdani FIS object, use one of the following methods:
The
mamfisfunction.If you have input and output training data (
inputDataandoutputData, respectively), you can use thegenfisfunction with the FCM clustering method.opt = genfisOptions('FCMClustering','FISType','mamdani'); fis = genfis(inputData,outputData,opt);
If you have a FIS file (
*.fis) for a Mamdani system, you can use thereadfisfunction.
Description
fis = mamfis returns a Mamdani FIS with default property values.
To modify the properties of the fuzzy system, use dot notation.
fis = mamfis( specifies FIS
configuration information or sets object properties using one or more name-value
arguments.Name=Value)
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: 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 bothNumInputsandNumOutputsare 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.
FIS name, specified as a string or character vector.
This argument sets the Name property.
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 valuesString 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
This argument sets the AndMethod property.
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, seeprobor.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.
This argument sets the OrMethod property.
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.
This argument sets the ImplicationMethod property.
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, seeprobor.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
This argument sets the AggregationMethod property.
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, specified as one of the following:
"centroid"— Centroid of the area under the output fuzzy set"bisector"— Bisector of the area under the output fuzzy set"mom"— Mean of the values for which the output fuzzy set is maximum"lom"— Largest value for which the output fuzzy set is maximum"som"— Smallest value for which the output fuzzy set is maximumString or character vector — Name of a custom defuzzification function in the current working folder or on the MATLAB path
Function handle — Custom defuzzification function in the current working folder or on the MATLAB path
This argument sets the DefuzzificationMethod
property.
For more information on using custom functions, see Build Fuzzy Systems Using Custom Functions.
For more information on defuzzification and the fuzzy inference process, see Fuzzy Inference Process.
Option to disable consistency checks when property values change, specified as a logical value.
By default, when you change the value of a property of a
mamfis 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
mamfis object.
To reenable the consistency checks, first verify that the changes you made to
the FIS are consistent and produce a valid mamfis object.
Then, set DisableStructuralChecks to
false. If the mamfis object is
invalid, reenabling the consistency checks generates an error.
This argument sets the DisableStructuralChecks
property.
Properties
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 valuesString 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, seeprobor.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, seeprobor.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, specified as one of the following:
"centroid"— Centroid of the area under the output fuzzy set"bisector"— Bisector of the area under the output fuzzy set"mom"— Mean of the values for which the output fuzzy set is maximum"lom"— Largest value for which the output fuzzy set is maximum"som"— Smallest value for which the output fuzzy set is maximumString or character vector — Name of a custom defuzzification function in the current working folder or on the MATLAB path
Function handle — Custom defuzzification 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 defuzzification and the fuzzy inference process, see Fuzzy Inference Process.
Option to disable consistency checks when property values change, specified as a logical value.
By default, when you change the value of a property of a
mamfis 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
mamfis object.
To reenable the consistency checks, first verify that the changes you made to the FIS
are consistent and produce a valid mamfis object. Then, set
DisableStructuralChecks to false. If the
mamfis 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) = [];
Object Functions
addInput | Add input variable to fuzzy inference system |
removeInput | Remove input variable from fuzzy inference system |
addOutput | Add output variable to fuzzy inference system |
removeOutput | Remove output variable from fuzzy inference system |
addRule | Add rule to fuzzy inference system |
addMF | Add membership function to fuzzy variable |
removeMF | Remove membership function from fuzzy variable |
evalfis | Evaluate fuzzy inference system |
writeFIS | Save fuzzy inference system to file |
convertToType2 | Convert type-1 fuzzy inference system into type-2 fuzzy inference system |
Examples
Create a Mamdani fuzzy inference system with default property values.
fis = mamfis;
Modify the system properties using dot notation. For example, configure fis to use centroid defuzzification.
fis.DefuzzificationMethod = "centroid";Alternatively, you can specify one of more FIS properties when you create a fuzzy system. For example, create a Mamdani fuzzy system with specified AND and OR methods.
fis = mamfis(AndMethod="prod",OrMethod="probor");
Create a 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: [1×3 fisvar]
Outputs: [1×1 fisvar]
Rules: [1×27 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 Mamdani FIS using the Fuzzy Logic Designer app. You can then export the system to the MATLAB workspace.
Version History
Introduced in R2018bThis function replaces newfis for creating Mamdani fuzzy inference
systems.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)