Main Content

Define Membership Functions Using Fuzzy Logic Designer

Since R2022b

Once you add a variable to your fuzzy inference system (FIS) using Fuzzy Logic Designer, you can define the membership functions (MFs) for that variable.

Add Membership Functions

To add membership functions to a given variable, select the variable in the System Browser or click the variable in the Fuzzy Inference System document. In the Property Editor, the app shows the input variable and membership function properties.

App showing an input variable selected in the System Browser on the left and in the Fuzzy Inference System Plot document in the center. The Property Editor on the right shows the variable properties, including an empty MF table.

To add an MF, on the Design tab, in the Add Components gallery, click MF.

App toolstrip with the MF option listed as the only option in the Add Components gallery

In the System Browser, the app adds an MF with a default configuration to the selected variable. You can view the properties of the MF in the table of the Property Editor.

App showing the new MF highlighted in the System Browser. The MF table in the property editor shows the new MF with name mf1, a triangular type, and default parameters [0 0.5 1].

You can also create a copy of an existing MF. To do so, in the System Browser, under the variable, right-click the membership function and select Add a copy.

System Browser showing the right-click menu for an MF. The cursor is over the Add a copy menu item.

The app creates a new MF with the same properties as the original MF and a modified name.

Distribute MFs Across Variable Range

Since R2023a

New MFs added to a variable have default properties. You can configure the values of these MFs manually. For more information, see Configure MFs.

You can also automatically distribute the existing MFs across the variable range. For example, the following figure shows three triangular membership function with the same default parameters.

Membership Function Editor and Property Editor showing three overlapping default MFs.

To distribute these MFs across the variable range, click Evenly Distribute MFs.

Membership Function Editor and Property Editor showing three MFs distributed across the variable range. On the right, the Evenly Distribute MFs button is highlighted.

View Membership Functions

To view a plot of the membership functions for a given variable, first select the variable in the System Browser. Then, open the Membership Function Editor document.

App showing the service variable selected in the System Browser on the left. In the center, the Membership Function Editor document shows three Gaussian MFs. On the right, the Property Editor lists MF names and properties.

You can view the properties of the MFs in the Property Editor.

Configure MFs

You can edit the properties of an MF in the Property Editor. The types of MFs available for a variable and the MF properties depend on the type of FIS that you are designing.

Type-1 MFs

The following variables use type-1 MFs.

  • Input and output variables of a type-1 Mamdani FIS

  • Input variables of a type-1 Sugeno FIS

To configure a type-1 MF, specify the following properties.

  • Name — Membership function name

  • Type — Membership function type

  • Parameters — Membership function parameters

Property Editor showing variable properties, including a table of MFs.

You can specify the built-in type-1 MFs in the following table.

TypeDescriptionMore Information
Generalized bellGeneralized bell-shaped membership functiongbellmf
GaussianGaussian membership functiongaussmf
Two-sided GaussianGaussian combination membership functiongauss2mf
TriangularTriangular membership functiontrimf
TrapezoidalTrapezoidal membership functiontrapmf
Linear S-shapedLinear s-shaped saturation membership functionlinsmf
Linear Z-shapedLinear z-shaped saturation membership functionlinzmf
SigmoidalSigmoidal membership functionsigmf
Difference of sigmoidsDifference between two sigmoidal membership functionsdsigmf
Product of sigmoidsProduct of two sigmoidal membership functionspsigmf
Z-shapedZ-shaped membership functionzmf
Pi-shapedPi-shaped membership functionpimf
S-shapedS-shaped membership functionsmf

You can also specify custom MFs. For more information, see Build Fuzzy Systems Using Custom Functions.

Type-2 MFs

The following variables use type-2 MFs.

  • Input and output variables of a type-2 Mamdani FIS

  • Input variables of a type-2 Sugeno FIS

To configure a type-2 MF, specify the following properties.

  • Name — Membership function name

  • Type — Membership function type

  • Upper Parameters — Upper membership function parameters

  • Lower Scale — Lower membership function scale factor

  • Lower Lag — Lower membership function delay factor, which defines the point at which the lower membership function value starts increasing from zero based on the value of the upper membership function. For example, a lag value of 0.1 indicates that the lower membership function becomes positive when the upper membership function has a membership value of 0.1.

Property Editor showing variable properties, including a table of MFs.

A type-2 MF consists of a type-1 upper MF and a scaled lower MF. The Type and Upper Parameters properties define the upper MF and correspond to the Type and Parameters properties of a type-1 MF.

For more information on type-2 MFs, see Type-2 Fuzzy Inference Systems.

Sugeno Output MFs

For the output variables of type-1 and type-2 Sugeno systems, you can specify the following types of MFs.

  • Constant — The location of the singleton MF in the output range is a constant value.

  • Linear — The location of the singleton MF in the output range is a linear function of the input values.

For these membership functions, you can specify the following parameters.

  • Name — Membership function name

  • Type — Membership function type

  • Parameters — Membership function parameters

Property Editor showing variable properties, including a table of MFs.

For more information on Sugeno systems, see Sugeno Fuzzy Inference Systems.

Interactively Edit MFs

You can also interactively adjust the properties of a built-in type-1 or type-2 MF. To do so, in the Membership Function Editor, first click the MF. Then, you can modify the MF by dragging the control points.

Type-1 triangular MF selected in Membership Function Editor with arrows indicating where to drag the control point at the triangle peak

Interactively editing a Sugeno output MF or a custom MF is not supported.

Delete MFs

To delete an MF from a variable, in the System Browser, under the variable, right-click the membership function and select Delete.

System Browser showing the right-click menu for an MF. The cursor is pointing to the Delete menu item.

When you delete an MF from a variable, any rules that contain that variable are also deleted.

See Also

Related Topics