Fuzzy Logic Designer
Design, test, and tune fuzzy inference systems
Description
The Fuzzy Logic Designer app lets you design, test, and tune a fuzzy inference system (FIS) for modeling complex system behavior.
Using this app, you can:
Design Mamdani and Sugeno FISs.
Design type-1 and type-2 FISs.
Tune the rules and membership functions of a FIS.
Design and tune FIS trees. (since R2023b)
Analyze the behavior of a fuzzy system, including:
View rule inference process for given input values.
View output surface maps for fuzzy inference systems.
Compare FIS outputs with corresponding output values from testing data. (since R2023a)
View error distributions across input ranges based on testing data. (since R2023a)
View the propagation of inference results through a FIS tree. (since R2024a)
Export FIS design to the MATLAB® workspace.
Export FIS design to Simulink® model. (since R2025a)
Generate MATLAB code for building, simulating, or tuning FIS designs.

Open the Fuzzy Logic Designer App
MATLAB Toolstrip: On the Apps tab, under Control System Design and Analysis, click the app icon.
MATLAB command prompt: Enter
fuzzyLogicDesigner
.Simulink model: In the Fuzzy Logic Controller block dialog, click Design.
Examples
To import a FIS from a file, select Import > Import Fuzzy Inference System from File.
In the Import Fuzzy Inference System dialog box, select a FIS or MAT file and click Open.
To import a FIS from the MATLAB workspace, under Import > Import Fuzzy Inference System from Workspace, click a FIS or FIS tree.
A new Fuzzy Logic Designer instance opens and loads the selected FIS.
Using Fuzzy Logic Designer, you can convert between Mamdani and Sugeno systems and between type-1 and type-2 systems.
To convert the active system, on the Design tab, in the Convert FIS section, click the corresponding conversion operation. The available operations depend on the type of the active FIS design.
To convert a Mamdani FIS into a Sugeno FIS, click Mamdani to Sugeno.
To convert a Sugeno FIS into a Mamdani FIS, click Sugeno to Mamdani.
To convert a type-1 FIS into a type-2 FIS, click Type-1 to Type-2.
To convert a type-2 FIS into a type-1 FIS, click Type-2 to Type-1.
The app adds the converted FIS to the Design Browser. To make the converted system active, select it in the Design Browser and click Set Active Design.
For more information on converting between Mamdani and Sugeno systems, see Mamdani and Sugeno Fuzzy Inference Systems.
For more information on converting between type-1 and type2 systems, see
convertToType1
and convertToType2
.
To save your FIS to a file, on the Design tab, under Save, select the fuzzy inference system.
You can select the current active design or any of the stored designs.
In the Save Fuzzy Inference System dialog box, specify a filename and location, and click Save.
When saving a FIS design, you can use a FIS file or a MAT file.
When saving a FIS tree design, you must use a MAT file.
To export a FIS design to the MATLAB workspace, on the Design tab, select Export > Export Fuzzy Inference System To Workspace.
The Export Fuzzy Inference System to Workspace dialog box lists the active FIS design along with any stored designs.
In the Export column, select one or more systems that you want to export.
The active FIS design is selected by default. (since R2024a)
In the Export As column, specify names for the workspace variables.
Click Export.
The app saves the FIS to the MATLAB workspace as one of the following types of objects.
mamfis
— Type-1 Mamdani FISsugfis
— Type-1 Sugeno FISmamfistype2
— Type-2 Mamdani FISsugfistype2
— Type-2 Sugeno FIS
Once you export your FIS, you can:
Perform additional simulations at the command line using the
evalfis
function.Simulate your system in Simulink using the Fuzzy Logic Controller block.
Generate code for your system. For more information, see Deployment.
After evaluating your FIS using Fuzzy Logic Designer, you can export the following simulation results to the MATLAB workspace for the active and stored designs.
Control surface data points
Rule inference data (individual FIS only)
Error distribution data (since R2023a)
System validation data (since R2023a)
FIS tree data flow results (FIS tree only) (since R2024a)
In Fuzzy Logic Designer, select Export > Export Simulation Results to Workspace.
The Export Simulation Results to Workspace dialog box lists the simulation results that are available for export. To export simulation results, you must first view the corresponding simulation document in the app.
The following figure shows the Export Simulation Results to Workspace dialog box for a single FIS object.
The Simulation Results column indicates the FIS
designs and the type of simulation data using one of the following entries,
where <design>
indicates the FIS design.
<design>_ControlSurfaceData
— Control surface data points<design>_RuleInferenceData
— Rule inference data<design>_ErrorDistributionData
— Error distribution dataSystemValidationData
— System validation data for all selected designs<design>_FISTreeDataFlowData
— FIS tree data flow results
In the Export column, select one or more simulation results that you want to export.
In the Export As column, specify names for the workspace variables.
Click Export.
The app saves each selected simulation result to the MATLAB workspace as a structure, as defined in the following table.
Simulation Data | Description |
---|---|
Control surface data points | Data points for the most recent plot displayed in the Control Surface document for the active design, exported as a structure with the following fields.
The dimensions of This control surface data matches
the data points generated by the |
Rule inference data | Rule inference results for the active design, including intermediate computed values, exported as a structure with the following fields.
The dimensions of the
|
Error distribution data (since R2023a) | Error distribution data for the active design, exported as a structure with the following fields, each containing a numeric array.
|
System validation data (since R2023a) | System validation data for all selected FIS designs, exported as a structure with the following fields.
A selected design is a design for which you select the Compare option in the Design Browser. |
FIS tree data flow results (since R2024a) | FIS tree data propagation for the active design using the most recent input values specified in the FIS Tree Plot document, exported as a structure with the following fields.
|
For the active FIS design, the exported simulation results correspond to the simulation settings, such as the input values in the Rule Inference document or the selected axes in the Control Surface document, currently defined in the app.
For a stored FIS design, the exported simulation results correspond to the simulation settings when the design was most recently active in the app. In other words, the exported results for a stored design may not use the simulation settings currently defined in the app.
Since R2024a
You can export tuning
options and tunable parameter settings to the MATLAB workspace. You can then use these options and settings when
tuning a FIS using tunefis
.
In Fuzzy Logic Designer, on the Tuning tab, select Export > Export Tuning Options and Settings to Workspace.
The Export Tuning Options and Settings to Workspace dialog box lists the current tuning options and tunable parameter settings in the app.
The Options and Settings column indicates the following options and settings available for export.
tuningOptions
— Tuning options, exported as atunefisOptions
objectinputSettings
— Input variable tunable settings, exported as a vector ofVariableSettings
objectsoutputSettings
— Output variable tunable settings, exported as a vector ofVariableSettings
objectsruleSettings
— Rule tunable settings, exported as a vector ofRuleSettings
objects
In the Export column, select the options or settings that you want to export.
In the Export As column, specify the name of the workspace variables.
Click Export.
The app saves the options and settings as objects in the MATLAB workspace. You can use these objects when tuning a FIS using
tunefis
.
Since R2025a
To export a FIS to a Simulink model, on the Design tab, select Export > Export to Simulink.
In the Export design to Simulink model dialog box, select a FIS design to export.
The software:
Exports the selected FIS object to the MATLAB workspace.
Creates a new Simulink model that contains a corresponding Fuzzy Logic Controller or FIS Tree block.
Configures the model to simulate the exported FIS object.
The model contains a Constant block for the FIS inputs and a Display block for the FIS outputs.
To generate MATLAB code for creating a FIS, on the Design tab, select Export > Generate MATLAB Script for a Design. (since R2024a)
For more information, see Generate MATLAB Code for Building Fuzzy Systems.
To generate MATLAB code for simulating a FIS, on the Design tab, select Export > Generate Simulation Function. (since R2024b)
For more information, see Generate MATLAB Code for Simulating Fuzzy Systems.
To generate MATLAB code for tuning a FIS, on the Tuning tab, select Export > Generate Tuning Function. (since R2024a)
For more information, see Generate MATLAB Code for Tuning Fuzzy Systems.
Related Examples
Programmatic Use
fuzzyLogicDesigner
opens the Fuzzy Logic Designer app and
loads the Getting Started dialog box, where you can open an existing FIS or create
an initial FIS structure. For more information, see Get Started Using Fuzzy Logic Designer.
fuzzyLogicDesigner(
opens the app and imports
the fuzzy inference system fis
)fis
. fis
can be
any of the following objects in the MATLAB workspace or on the path.
mamfis
— Type-1 Mamdani FISsugfis
— Type-1 Sugeno FISmamfistype2
— Type-2 Mamdani FISsugfistype2
— Type-2 Sugeno FISfistree
— Tree of interconnected FISs (since R2023b)
fuzzyLogicDesigner(
opens the app and loads
a fuzzy inference system from a file. fileName
)fileName
is the name of
one of the following types of files on the MATLAB path.
FIS file (
*.fis
) — Load amamfis
,sugfis
,mamfistype2
, orsugfistype2
object.MAT file (
*.mat
) — The MAT file must contain only onemamfis
,sugfis
,mamfistype2
,sugfistype2
, orfistree
object. (since R2024a)
Version History
Introduced in R2014bYou can now open Fuzzy Logic Designer from the Fuzzy Logic Controller block by clicking Design in the block parameters.
You can now export the active fuzzy system to a Simulink model that contains a corresponding Fuzzy Logic Controller or FIS Tree block.
For more information, see Export FIS to Simulink.
You can now generate MATLAB code to programmatically simulate a fuzzy inference system. For more information, see Generate MATLAB Code for Simulating Fuzzy Systems.
Fuzzy Logic Designer no longer supports fuzzy inference system
structures. Use mamfis
and
sugfis
objects instead. To convert existing fuzzy inference system structures to objects,
use the convertfis
function.
You can now generate MATLAB code to programmatically build or tune a fuzzy inference system. You can then use or modify the generated code for your applications.
For more information on generating MATLAB code for:
Building a fuzzy system, see Generate MATLAB Code for Building Fuzzy Systems.
Tuning a fuzzy system, see Generate MATLAB Code for Tuning Fuzzy Systems.
You can now evaluate the behavior of a FIS tree by viewing the propagation of inference results through the tree structure for specified input values. For more information, see FIS Tree Data Flow.
You can now export tuning options and tunable settings from Fuzzy Logic Designer to the MATLAB workspace. For more information, see Export Tuning Options and Settings.
You can now programmatically open Fuzzy Logic Designer and specify the name of a MAT file that contains one FIS or FIS tree object. The app opens and imports the FIS or FIS tree object.
You can now interactively design, tune, and analyze FIS trees using the app.
For more information, see the following examples.
When tuning FIS designs in Fuzzy Logic Designer, tunable parameter selections are now stored separately for each design. Previously, the app maintained a single set of tunable parameters for each app session.
You can now interactively tune the rules and membership function parameters of the following types of fuzzy inference systems.
Mamdani and Sugeno systems
Type-1 and type-2 systems
For an example, see Tune Fuzzy Inference System Using Fuzzy Logic Designer.
You can now interactively evaluate the performance of fuzzy inference system designs for given input/output testing data using the following documents in the app.
System Validation — Compare the outputs from each FIS design with the corresponding output value from the testing data.
Error Distribution — For a given FIS design, view the output error for different combinations of inputs.
For more information on analyzing FIS designs, see Analyze Fuzzy System Using Fuzzy Logic Designer.
When defining membership functions for input and output variables, you can now evenly distribute existing membership function across the variable range. For more information on defining membership functions, see Define Membership Functions Using Fuzzy Logic Designer.
The redesigned app streamlines workflows for interactively building fuzzy inference systems. Using the updated app, you can:
Design both Mamdani and Sugeno fuzzy inference systems
Design fuzzy inference systems with either type-1 or type-2 membership functions
Support for fuzzy inference systems structures will be removed in a future release. This change was announced in R2018b. Using fuzzy inference system structures with Fuzzy Logic Designer issues a warning starting in R2019b.
Previously, the command to open the app was fuzzy
.
See Also
Functions
evalfis
|plotfis
|mamfis
|sugfis
|mamfistype2
|sugfistype2
|fistree
External Websites
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)