Video length is 6:23

Overview and Applications | Getting Started with Fuzzy Logic Toolbox

From the series: Getting Started with Fuzzy Logic Toolbox

Watch a brief overview of fuzzy logic, the benefits of using it, and where it can be applied. Application areas include control system design, signal processing, and decision-making systems.

Published: 17 Apr 2023

In this video we’ll see a brief overview of fuzzy logic, why use it, and its application areas.

So let's start with what is fuzzy logic. So let's consider this exercise. If I were to ask you how your day has been so far, some of you here might say it has been pretty good, some might say not great, and some might even say it's just been OK. So now let's focus on the answer of pretty good. So what is pretty good to you might not be the same as when I say pretty good or when somebody else says pretty good. That is the definition of pretty good can vary from person to person.

So unlike a binary logic where there is just one truth to the statement, unlike being just true or false or just 0 or 1, fuzzy logic is a degree of truth. And it contains a range of values between 0 and 1. So that is fuzziness and that is vagueness. And I will let you hold on to this thought for a minute.

Now let's consider another example where you have to tip a waiter at a restaurant based on the quality of food and the quality of service that you've received the last time you visited the restaurant. And the way you would go about figuring out the tip percentage would be that it would be based on some logical rules such as this. Something like if the service that you experienced was excellent and the food that you had was delicious, then you would perhaps tip generously. Or on the other hand, if the service that you received was poor or the food that you had was not great or rancid, then the tip percentage would be low.

So the decisions that you make here are based on logical rules. So fuzzy systems try to solve the problem in a similar way. That is fuzzy systems mimic the way humans try to solve problems by mapping inputs to outputs using logical rules, which are easily interpretable.

Now, in terms of what is the benefit of using fuzzy logic or why use fuzzy logic. So fuzzy logic can be extremely beneficial and can be used to model complex decision systems that are difficult to describe using other modeling approaches generally but can be described by rules.

To demonstrate this, let's take the same example of the tipping problem where you want to create a mapping of inputs to outputs, something like the image that you see on the screen. So if you can focus on the image, you'll see that you want to provide a generous tip when the quality of service and the quality of food is high. And you want to provide a lower tip when the quality of food and the quality of service is bad. And the flat area in between shows the average tip percentage at about 15%, which is the average tip percentage in the US.

So let's try to do this using the non-fuzzy approach first and then we'll come to the fuzzy approach. So with the non-fuzzy approach, this is what the MATLAB code would look like if you were to try it. Right now this code is parameterized so that you can change the definition of good, bad food and service, and cheap and generous tip in numerical terms.

And this code creates this piecewise linear surface, the mapping surface that we saw in the image. So as you can see even for this simple initial model that we started off with, the code is already looking cluttered and is difficult to understand and probably difficult to maintain.

Now say if I want to make modifications to the surface, say I want to make this tipping system more complex or better by making a few changes in the surface, to make such modifications and translate that into MATLAB code with a non-fuzzy approach could be challenging to incorporate it.

On the other hand, with the fuzzy approach, you can formulate the same answer using simple linguistic rules, similar to how humans tried to solve this problem. Here even if you want to make modifications to the surface, that is by say you want to make it smoother or make certain areas of the surface sharper to make the system better, you can do that by just modifying the rules or perhaps just by making few changes to the range of the values for each of those fuzzy parameters or fuzzy variables. This way it is easy to modify, maintain, and understand fuzzy systems.

So this is where fuzzy logic adds value. That is by making it easier to create complex systems for which you might not know much about the underlying mathematical equations or dynamics, but you have some expert knowledge which you can encode in the form of logical rules.

And fuzzy logic can be used for a variety of problems and applications. It can be used for control design applications across medical applications, autonomous driving, robotics, et cetera.

And fuzzy logic on the other hand can also be used for intelligent decision making or for creating intelligent decision making systems for finance-related applications, for scheduling, for resource allocation, and so on.

Similarly, fuzzy logic can also be applied for signal processing applications for image processing, speech processing, image segmentation, and so on.

And using the toolbox, the common workflow that you can use to create and evaluate fuzzy system is you can start by defining inputs and outputs to your system. You can then define membership functions. You can then create rules to map these inputs to outputs. And then finally, evaluate your fuzzy system.

Now, all of these steps mentioned above can be accomplished either by using command line functions provided with the toolbox or using the Fuzzy Logic Designer app. However, it is often more convenient to use the graphical user interface, and that is what we will see in the next video.

Related Products

Learn More