Skip to content
MathWorks - Mobile View
  • Inicie sesión cuenta de MathWorksInicie sesión cuenta de MathWorks
  • Access your MathWorks Account
    • Mi Cuenta
    • Mi perfil de la comunidad
    • Asociar Licencia
    • Cerrar sesión
  • Productos
  • Soluciones
  • Educación
  • Soporte
  • Comunidad
  • Eventos
  • Obtenga MATLAB
MathWorks
  • Productos
  • Soluciones
  • Educación
  • Soporte
  • Comunidad
  • Eventos
  • Obtenga MATLAB
  • Inicie sesión cuenta de MathWorksInicie sesión cuenta de MathWorks
  • Access your MathWorks Account
    • Mi Cuenta
    • Mi perfil de la comunidad
    • Asociar Licencia
    • Cerrar sesión

Vídeos y webinars

  • MathWorks
  • Vídeos
  • Vídeos-Inicio
  • Buscar
  • Vídeos-Inicio
  • Buscar
  • Comuníquese con ventas
  • Software de prueba
5:05 Video length is 5:05.
  • Description
  • Full Transcript
  • Related Resources

Getting Started with Fuzzy Logic Toolbox, Part 1

From the series: Getting Started with Fuzzy Logic Toolbox

Use Fuzzy Logic Toolbox™ to design fuzzy logic systems.

Fuzzy Logic Toolbox provides graphical user interfaces, MATLAB functions, and Simulink blocks for designing and simulating Fuzzy Logic systems. When is Fuzzy Logic useful? It is useful when you're developing system models and nonlinear controllers when precise definitions and boundaries do not exist or are too rigid.

Let's consider an example. In this simple demo, we will build a Fuzzy Logic system to solve the tipping problem shown here, which is to determine the proper tip percentage for a waiter in a restaurant based on quality of service and quality of food. In the United States, the average tip is 15% but can vary depending on the quality of food and service. So what we want here is to create a mapping between two inputs-- quality of food and quality of service-- and the output-- tip amount.

You would like to create the mapping somewhat similar to what is shown here. Tip should be generous when food and service are great and should be low when they are bad with somewhat flat area in the middle at about 15%, which is average tip percentage. First, let's see how you would solve that problem with non-fuzzy approach if we didn't use Fuzzy Logic Toolbox.

So what we see here is MATLAB codes that we would have to write. It creates this piece-wise linear surface that we saw in the previous slide. And this code is parametrized so that we can easily change our definitions of good and bad, food and service, and cheap and generous tip in numerical terms.

We see that the quote is difficult to understand and probably difficult to modify and maintain. It is made somewhat easier to understand by comments. What if you could use the rules described in these comments for directly designing the logic?

This is where Fuzzy Logic and Fuzzy Logic Toolbox come in. So those are the three simple rules that we have. And the Fuzzy Logic is a good solution here because it's easier to formulate the answer using simple linguistic rules as shown here. And trying to code this in MATLAB without using Fuzzy Logic Toolbox is difficult. Code is hard to understand and difficult to maintain and change.

So in that demo, we will design and simulate this Fuzzy Logic system from scratch. And in the process, you will see the various important capabilities of Fuzzy Logic Toolbox. We will go through four basic steps of building and simulating a Fuzzy Logic system.

First, define inputs and outputs. Second, great membership functions. Third, creates rules. And fourth and final, simulate the resulting Fuzzy Logic system.

All of the steps can be accomplished by using Fuzzy Logic command line functions. However, it is often more convenient to use graphical user interfaces. And that is what we will do here.

So let's now switch to MATLAB. And we will start Fuzzy Logic Toolbox by typing fuzzy at MATLAB command line. This starts the first of the five graphical user interfaces that we will see in this demo-- FIS editor, which stands for Fuzzy Inference System.

The FIS editor handles the high level issues for the system such as number of input and output variables and variable names. Fuzzy Logic toolbox doesn't limit the number of inputs or outputs allowed. This example, as we saw, has two inputs and one output.

So let's start by defining these two inputs and one output. By default, we have one input and one output. So we will add a new input variable, and we will define inputs and outputs.

The first input is going to be quality of service. We'll call it service. The second output is going to be quality of food. We'll call it food.

And the output is going to be tip percentage. We'll call it tip. OK.

This system diagram shows the name of the system and the type of inference used. We see is that the system was untitled right now. So let's save it. For that, we're going to File, Menu, and Export to File.

And we will save it into file tipper_demo. So now we see the name of our system. In this area, we see pop-up menus which are used to adjust fuzzy inference functions such as and method, or method, and defuzzification method. We will leave all these at their default values. The status line here describes the most recent declaration.

Related Products

  • Fuzzy Logic Toolbox

3 Ways to Speed Up Model Predictive Controllers

Read white paper

A Practical Guide to Deep Learning: From Data to Deployment

Read ebook

Bridging Wireless Communications Design and Testing with MATLAB

Read white paper

Deep Learning and Traditional Machine Learning: Choosing the Right Approach

Read ebook

Hardware-in-the-Loop Testing for Power Electronics Control Design

Read white paper

Predictive Maintenance with MATLAB

Read ebook

Electric Vehicle Modeling and Simulation - Architecture to Deployment : Webinar Series

Register for Free

How much do you know about power conversion control?

Start quiz

Feedback

Featured Product

Fuzzy Logic Toolbox

  • Request Trial
  • Get Pricing

Up Next:

Define membership functions and rules for fuzzy inference systems.
8:06
Part 2
View full series (3 Videos)

Related Videos:

8:06
Getting Started with Fuzzy Logic Toolbox, Part 2
4:47
Getting Started with Fuzzy Logic Toolbox, Part 3
3:39
Fuzzy Logic Controller in Simulink
5:09
Getting Started with Trading Toolbox, Part 2: Specify...
4:40
Getting Started with Trading Toolbox, Part 3: Specify...

View more related videos

MathWorks - Domain Selector

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: .

  • Switzerland (English)
  • Switzerland (Deutsch)
  • Switzerland (Français)
  • 中国 (简体中文)
  • 中国 (English)

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
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
    • 简体中文Chinese
    • English
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

  • Comuníquese con ventas
  • Software de prueba

MathWorks

Accelerating the pace of engineering and science

MathWorks es el líder en el desarrollo de software de cálculo matemático para ingenieros

Descubra…

Explorar productos

  • MATLAB
  • Simulink
  • Software para estudiantes
  • Soporte para hardware
  • File Exchange

Probar o comprar

  • Descargas
  • Software de prueba
  • Comuníquese con ventas
  • Precios y licencias
  • Cómo comprar

Aprender a utilizar

  • Documentación
  • Tutoriales
  • Ejemplos
  • Vídeos y webinars
  • Formación

Obtener soporte

  • Ayuda para la instalación
  • MATLAB Answers
  • Consultoría
  • Centro de licencias
  • Comuníquese con soporte

Acerca de MathWorks

  • Ofertas de empleo
  • Sala de prensa
  • Misión social
  • Casos prácticos
  • Acerca de MathWorks
  • Select a Web Site United States
  • Centro de confianza
  • Marcas comerciales
  • Política de privacidad
  • Antipiratería
  • Estado de las aplicaciones

© 1994-2022 The MathWorks, Inc.

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • LinkedIn
  • RSS

Únase a la conversación