Function Reference: addmf

Function File: fis = addmf (fis, in_or_out, var_index, mf_name, mf_type, mf_params)

Add a membership function to an existing FIS structure and return the updated FIS.

The types/values of the arguments are expected to be:

ArgumentExpected Type or Value
fisan FIS structure
in_or_out’input’ or ’output’ (case-insensitive)
var_indexvalid index of an FIS input/output variable
mf_namea string
mf_typea string
mf_paramsa vector

If mf_type is one of the built-in membership functions, then the number and values of the parameters must satisfy the membership function requirements for the specified mf_type.

Note that addmf will allow the user to add membership functions or membership function names for a given input or output variable that duplicate mfs or mf names already entered.

Also, constant and linear membership functions are not restricted to FIS structure outputs or to Sugeno-type FIS structures, and the result of using them for FIS inputs or Mamdani-type FIS outputs has not yet been tested.

To run the demonstration code, type "demo addmf" (without the quotation marks) at the Octave prompt. This demo creates two FIS input variables and associated membership functions and then produces two figures showing the term sets for the two FIS inputs.

See also: rmmf, setfis

Example: 1

 

 ## Create new FIS.
 a = newfis ('Heart-Disease-Risk', 'sugeno', ...
             'min', 'max', 'min', 'max', 'wtaver');
 
 ## Add two inputs and their membership functions.
 a = addvar (a, 'input', 'LDL-Level', [0 300]);
 a = addmf (a, 'input', 1, 'Low', 'trapmf', [-1 0 90 110]);
 a = addmf (a, 'input', 1, 'Low-Borderline', 'trapmf', ...
            [90 110 120 140]);
 a = addmf (a, 'input', 1, 'Borderline', 'trapmf', ...
            [120 140 150 170]);
 a = addmf (a, 'input', 1, 'High-Borderline', 'trapmf', ...
            [150 170 180 200]);
 a = addmf (a, 'input', 1, 'High', 'trapmf', [180 200 300 301]);
 
 a = addvar (a, 'input', 'HDL-Level', [0 100]);
 a = addmf (a, 'input', 2, 'Low-HDL', 'trapmf', [-1 0 35 45]);
 a = addmf (a, 'input', 2, 'Moderate-HDL', 'trapmf', [35 45 55 65]);
 a = addmf (a, 'input', 2, 'High-HDL', 'trapmf', [55 65 100 101]);
 
 ## Plot the input membership functions.
 plotmf (a, 'input', 1);
 plotmf (a, 'input', 2);

hold is now off for current axes
hold is now off for current axes
                    
plotted figure

plotted figure