Define Membership Functions Using Fuzzy Logic Designer
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.
To add an MF, on the Design tab, in the Add Components gallery, click MF.
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.
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.
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.
To distribute these MFs across the variable range, click Evenly Distribute MFs.
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.
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
You can specify the built-in type-1 MFs in the following table.
Type | Description | More Information |
---|---|---|
Generalized bell | Generalized bell-shaped membership function | gbellmf |
Gaussian | Gaussian membership function | gaussmf |
Two-sided Gaussian | Gaussian combination membership function | gauss2mf |
Triangular | Triangular membership function | trimf |
Trapezoidal | Trapezoidal membership function | trapmf |
Linear S-shaped | Linear s-shaped saturation membership function | linsmf |
Linear Z-shaped | Linear z-shaped saturation membership function | linzmf |
Sigmoidal | Sigmoidal membership function | sigmf |
Difference of sigmoids | Difference between two sigmoidal membership functions | dsigmf |
Product of sigmoids | Product of two sigmoidal membership functions | psigmf |
Z-shaped | Z-shaped membership function | zmf |
Pi-shaped | Pi-shaped membership function | pimf |
S-shaped | S-shaped membership function | smf |
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 of0.1
.
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
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.
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.
When you delete an MF from a variable, any rules that contain that variable are also deleted.