Main Content

removeMF

Remove membership function from fuzzy variable

Description

fis = removeMF(fis,varName,mfName) removes the membership function mfName from the input or output variable varName in the fuzzy inference system fis. To use this syntax, varName must be a unique variable name within fis.

Additionally, the specified membership function is removed from any fuzzy rules. If a rule has only the specified membership function in its antecedent, then the entire rule is removed. If a rule has more than one membership function in its antecedent, then the specified membership function is removed from the antecedent.

example

fis = removeMF(fis,varName,mfName,'VariableType',varType) removes the membership function from either an input or output variable as specified by varType. Use this syntax when your FIS has an input variable with the same name as an output variable.

example

var = removeMF(var,varName,mfName) removes the membership function mfName from the fuzzy variable var.

example

Examples

collapse all

Create a Mamdani fuzzy inference system with two inputs and one output. By default, when you specify the number of inputs and outputs, mamfis adds three membership functions to each variable.

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.

Name the variables. For this example, give the second input variable and the output variable the same name.

fis.Inputs(1).Name = "speed";
fis.Inputs(2).Name = "throttle";
fis.Inputs(3).Name = "distance";
fis.Outputs(1).Name = "throttle";

View the membership functions for the first input variable.

plotmf(fis,"input",1)

Figure contains an axes object. The axes object with xlabel speed, ylabel Degree of membership contains 6 objects of type line, text.

Remove the second membership function, mf2, from the first input variable.

fis = removeMF(fis,"speed","mf2");

View the membership functions again. The specified membership function has been removed.

plotmf(fis,"input",1)

Figure contains an axes object. The axes object with xlabel speed, ylabel Degree of membership contains 4 objects of type line, text.

If your system has an input variable with the same name as an output variable, you must specify the variable type when removing a membership function. For example, remove the mf3 membership function from the output variable.

fis = removeMF(fis,"throttle","mf3",VariableType="output");

View the membership functions of the output variable.

plotmf(fis,"output",1)

Figure contains an axes object. The axes object with xlabel throttle, ylabel Degree of membership contains 4 objects of type line, text.

Create a fuzzy variable with a specified range and add three membership functions.

var = fisvar([0 10]);
var = addMF(var,"trimf",[0 2.5 5],Name="small");
var = addMF(var,"trimf",[2.5 5 7.5],Name="medium");
var = addMF(var,"trimf",[5 7.5 10],Name="large");

View the membership functions.

var.MembershipFunctions
ans = 
  1×3 fismf array with properties:

    Type
    Parameters
    Name

  Details:
           Name       Type         Parameters    
         ________    _______    _________________

    1    "small"     "trimf"      0    2.5      5
    2    "medium"    "trimf"    2.5      5    7.5
    3    "large"     "trimf"      5    7.5     10

Remove the medium membership function from the variable.

var = removeMF(var,"medium");

Verify that the membership was removed.

var.MembershipFunctions
ans = 
  1×2 fismf array with properties:

    Type
    Parameters
    Name

  Details:
          Name       Type        Parameters   
         _______    _______    _______________

    1    "small"    "trimf"    0    2.5      5
    2    "large"    "trimf"    5    7.5     10

Input Arguments

collapse all

Fuzzy inference system, specified as one of these objects:

  • mamfis — Mamdani fuzzy inference system

  • sugfis — Sugeno fuzzy inference system

  • mamfistype2 — Type-2 Mamdani fuzzy inference system

  • sugfistype2 — Type-2 Sugeno fuzzy inference system

Variable name, specified as a string or character vector. You can specify the name of either an input or output variable in your FIS.

Membership function name, specified as a string or character vector.

Variable type, specified as one of these values:

  • "input" — Input variable

  • "output" — Output variable

If your system has an input variable with the same name as an output variable, specify which variable to remove the membership function from using varType.

Fuzzy variable, specified as a fisvar object.

Version History

Introduced in R2018b

expand all