来自该系列:Getting Started with Fuzzy Logic Toolbox
使用模糊逻辑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.
让我们考虑一个例子。在这个简单的演示中,我们将建立一个模糊的逻辑系统来解决此处显示的小费问题,该系统是根据服务质量和食物质量来确定餐厅中服务员的适当小费百分比。在美国,平均提示为15%,但根据食物和服务的质量可能有所不同。因此,我们想要的是在两个输入之间创建一个映射 - 食物质量和服务质量 - 以及输出 - 提示金额。
你想创建映射有所思米lar 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.
因此,我们在这里看到的是我们必须编写的MATLAB代码。它创建了我们在上一张幻灯片中看到的这件线性表面。并且该代码已进行了参数化,因此我们可以轻松地更改对好与坏,食物和服务的定义,并以数值术语更便宜而大方的技巧。
我们看到报价很难理解,可能很难修改和维护。通过评论使它更容易理解。如果您可以使用这些评论中描述的规则直接设计逻辑怎么办?
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.
因此,在该演示中,我们将从头开始设计和模拟此模糊逻辑系统。在此过程中,您将看到模糊逻辑工具箱的各种重要功能。我们将浏览构建和模拟模糊逻辑系统的四个基本步骤。
首先,定义输入和输出。第二,出色的会员职能。第三,创建规则。第四和最后一个也是最后一个,模拟所得的模糊逻辑系统。
所有步骤都可以通过使用模糊逻辑命令行函数来完成。但是,使用图形用户界面通常更方便。这就是我们在这里做的。
因此,现在让我们切换到MATLAB。我们将通过在MATLAB命令行中键入模糊来启动模糊逻辑工具箱。这启动了我们将在此演示中看到的五个图形用户界面中的第一个 - FIS编辑器,该编辑器代表模糊推理系统。
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.
因此,让我们从定义这两个输入和一个输出开始。默认情况下,我们有一个输入和一个输出。因此,我们将添加一个新的输入变量,并将定义输入和输出。
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.
并且输出将为小费百分比。我们将其称为小费。好的。
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.
我们将其保存到文件tipper_demo中。因此,现在我们看到了系统的名称。在该区域,我们看到弹出菜单,用于调整模糊推理功能,例如和方法,方法和Defuzzification方法。我们将把所有这些都留为它们的默认值。这里的状态线描述了最新声明。
您还可以从以下列表中选择一个网站:
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。