removeMF

Remove membership function from fuzzy variable

Syntax

fisOut = removeMF(fisIn,varName,mfName)
fisOut = removeMF(fisIn,varName,mfName,'VariableType',varType)
varOut = removeMF(varIn,varName,mfName)

Description

example

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

example

fisOut = removeMF(fisIn,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

varOut = removeMF(varIn,varName,mfName) removes the membership function mfName from the fuzzy variable varIn and returns the resulting fuzzy variable in varOut.

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"
                     Inputs: [1x3 fisvar]
                    Outputs: [1x1 fisvar]
                      Rules: [1x27 fisrule]
    DisableStructuralChecks: 0

	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)

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)

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)

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 = 
  1x3 fismf array with properties:

    Name
    Type
    Parameters

  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 = 
  1x2 fismf array with properties:

    Name
    Type
    Parameters

  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 a mamfis or sugfis object.

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 the following:

  • "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.

Output Arguments

collapse all

Fuzzy inference system, returned as a mamfis or sugfis object. fisOut has the same properties as fisIn except:

  • The membership function with the specified name is removed from the specified variable.

  • 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.

Fuzzy variable, returned as a fisvar object. varOut has the same properties as varIn except the membership function with the specified name is removed.

Introduced in R2018b