Accelerating the pace of engineering and science

# Fuzzy Logic Toolbox

## Key Features

• Fuzzy Logic Design app for building fuzzy inference systems and viewing and analyzing results
• Membership functions for creating fuzzy inference systems
• Support for AND, OR, and NOT logic in user-defined rules
• Standard Mamdani and Sugeno-type fuzzy inference systems
• Automated membership function shaping through neuroadaptive and fuzzy clustering learning techniques
• Ability to embed a fuzzy inference system in a Simulink model
• Ability to generate embeddable C code or stand-alone executable fuzzy inference engines
Balancing a pole on a moving cart. The system, which is similar to an inverted pendulum, uses a Fuzzy Controller block within Simulink to balance the pole.

## Working with the Fuzzy Logic Toolbox

The Fuzzy Logic Toolbox provides apps to let you perform classical fuzzy system development and pattern recognition. Using the toolbox, you can:

• Develop and analyze fuzzy inference systems
• Develop adaptive neurofuzzy inference systems
• Perform fuzzy clustering

In addition, the toolbox provides a fuzzy controller block that you can use in Simulink to model and simulate a fuzzy logic control system. From Simulink, you can generate C code for use in embedded applications that include fuzzy logic.

Like all MATLAB toolboxes, Fuzzy Logic Toolbox can be customized. You can inspect algorithms, modify source code, and add your own membership functions or defuzzification techniques.

Getting Started with Fuzzy Logic Toolbox, Part 1
Use Fuzzy Logic Toolbox™ to design fuzzy logic systems.

Getting Started with Fuzzy Logic Toolbox, Part 2
Define membership functions and rules for fuzzy inference systems.

Getting Started with Fuzzy Logic Toolbox, Part 3
Simulate and analyze fuzzy inference systems.

## Building a Fuzzy Inference System

Fuzzy inference is a method that interprets the values in the input vector and, based on user-defined rules, assigns values to the output vector. Using the editors and viewers in the Fuzzy Logic Toolbox, you can build the rules set, define the membership functions, and analyze the behavior of a fuzzy inference system (FIS). The following editors and viewers are provided:

FIS Editor - Displays general information about a fuzzy inference system

Membership Function Editor - Lets you display and edit the membership functions associated with the input and output variables of the FIS

Rule Editor - Lets you view and edit fuzzy rules using one of three formats: full English-like syntax, concise symbolic notation, or an indexed notation

Rule Viewer - Lets you view detailed behavior of a FIS to help diagnose the behavior of specific rules or study the effect of changing input variables

Surface Viewer - Generates a 3-D surface from two input variables and the output of an FIS

The Membership Function Editor (top left), FIS Editor (center), Rule Editor (top right), Rule Viewer (bottom left), and Surface Viewer (bottom right).

## Modeling Using Fuzzy Logic

The Fuzzy Logic Toolbox lets you apply neurofuzzy and clustering techniques to model and classify system behavior.

### Adaptive Neurofuzzy Inference

Using the Neuro-Fuzzy Design app, you can shape membership functions by training them with input/output data rather than specifying them manually. The toolbox uses a back propagation algorithm alone or in combination with a least squares method, enabling your fuzzy systems to learn from the data.

The Neuro-Fuzzy Design app constructs and tunes a FIS based on the data being modeled.

### Fuzzy Clustering

The Fuzzy Logic Toolbox provides support for fuzzy C-means and subtractive clustering, modeling techniques for data classification and modeling.

The Fuzzy Clustering tool uses numerical data to develop classification and system modeling algorithms.

## Simulating and Deploying Fuzzy Inference Systems

You can evaluate FIS performance by using the Fuzzy Logic Controller block in a Simulink model of your system. The Fuzzy Logic Controller block automatically generates a hierarchical block diagram representation for most fuzzy inference systems. This representation uses only built-in Simulink blocks, enabling efficient code generation (using Simulink Coder, available separately).

Fuzzy Logic Controller in Simulink
Integrate a fuzzy logic controller into a Simulink® model.

You can also save your FIS in ASCII format for use outside the MATLAB environment. The toolbox supplies a fuzzy inference engine that can execute your fuzzy system as a stand-alone application or embedded in an external application.