模糊控制算法matlab代码
时间: 2023-10-27 17:26:39 浏览: 365
一个完整的模糊控制器实现的Matlab代码示例如下:
```
%模糊控制器实现示例
clear all;
fisMat = mamfis;
fisMat = addInput(fisMat,[0 7],'Name',"E");
fisMat = addMF(fisMat,'E','trimf',[0 1 4.333],'Name','small');
fisMat = addMF(fisMat,'E','trimf',[1.6667 6 7],'Name','big');
fisMat = addOutput(fisMat,[0 7],'Name',"U");
fisMat = addMF(fisMat,'U','trimf',[0 1 4.333],'Name','small');
fisMat = addMF(fisMat,'U','trimf',[1.6667 6 7],'Name','big');
rulelist = [1 1 1 1;2 2 1 1];
fisMat = addRule(fisMat,rulelist);
u = evalfis(fisMat,4)
```
这段代码实现了一个模糊控制器。首先,我们创建一个mamfis对象,并添加输入和输出变量。在这个例子中,输入变量"E"的范围是0到7,输出变量"U"的范围也是0到7。然后,我们定义了输入和输出变量的隶属函数,例如"small"和"big"。接下来,我们定义了模糊规则列表,并将其添加到模糊控制器中。最后,我们使用evalfis函数来计算输入值为4时的模糊输出。
以上就是一个简单的模糊控制算法的Matlab代码示例。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [智能算法:Galaxy Gravity Optimization Algorithm (GGO)星系引力优化算法Matlab](https://download.csdn.net/download/weixin_39168167/88275205)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [matlab用脚本实现模糊控制](https://blog.csdn.net/qq_36262908/article/details/126772444)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [【路径规划】基于模糊控制的路径规划算法附Matlab代码](https://blog.csdn.net/Matlab_dashi/article/details/130202911)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文