This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Evaluate fuzzy membership function


y = evalmf(mf,x)



y = evalmf(mf,x) evaluates one or more membership functions in mf based on the input values in x.


collapse all

Evaluate a generalized bell-shaped membership function across a range of input values from 0 through 10.

x = 0:0.1:10;
mf = fismf("gbellmf",[2 4 6]);
y = evalmf(mf,x);

Plot the evaluation.

xlabel('gbellmf, P = [2 4 6]')

Create a vector of three Gaussian membership functions.

mf = [fismf("gaussmf",[0.9 2.5],'Name',"low");
      fismf("gaussmf",[0.9 5],'Name',"medium");
      fismf("gaussmf",[0.9 7.55],'Name',"high")];

Specify the input range over which to evaluate the membership functions.

x = (-2:0.1:12)';

Evaluate the membership functions.

y = evalmf(mf,x);

Plot the evaluation results.

xlabel('Input (x)')
ylabel('Membership value (y)')

Input Arguments

collapse all

Membership function, specified as a fismf object or a vector of fismf objects.

Input value, specified as a scalar, vector, or 2-D matrix. If mf is a:

  • Single fismf object, then you can specify x as a scalar, vector, or matrix.

  • Vector of fismf objects, then you can specify x as a scalar or vector

Output Arguments

collapse all

Output membership value, returned as a scalar, vector, or 2-D matrix. If mf is a:

  • Single fismf object, then y is a scalar, vector, or matrix with the same dimensions as x. Each element of y is the evaluated membership value for the corresponding element of x.

  • Vector of fismf objects, then y is an M-by-N matrix, where M and N are the lengths of mf and x, respectively. y(i,j) is the evaluated value of membership function mf(i) for input value x(j).

Compatibility Considerations

expand all

Behavior changed in R2018b

Introduced before R2006a