1.软件版本

matlab2013b

2.系统概述

·第一个模型:

·第二个模型

,U=13.012

第一:隶属函数的设计

隶属函数的设计,可以通过模糊编辑器,也可以通过如上的代码进行设计。

第二:模糊规则的设计

通过输入模糊规则量化表进行设计,所得到的模糊规则如下所示:

1. If (e is NB) and (ec is NB) then (u is PB) (1)

2. If (e is NB) and (ec is NM) then (u is PB) (1)

3. If (e is NB) and (ec is NS) then (u is PM) (1)

4. If (e is NB) and (ec is Z) then (u is PM) (1)

5. If (e is NB) and (ec is PS) then (u is PS) (1)

6. If (e is NB) and (ec is PM) then (u is PS) (1)

7. If (e is NB) and (ec is PB) then (u is Z) (1)

8. If (e is NM) and (ec is NB) then (u is PB) (1)

9. If (e is NM) and (ec is NM) then (u is PM) (1)

10. If (e is NM) and (ec is NS) then (u is PM) (1)

11. If (e is NM) and (ec is Z) then (u is PS) (1)

12. If (e is NM) and (ec is PS) then (u is PS) (1)

13. If (e is NM) and (ec is PM) then (u is Z) (1)

14. If (e is NM) and (ec is PB) then (u is NS) (1)

15. If (e is NS) and (ec is NB) then (u is PM) (1)

16. If (e is NS) and (ec is NM) then (u is PM) (1)

17. If (e is NS) and (ec is NS) then (u is PS) (1)

18. If (e is NS) and (ec is Z) then (u is PS) (1)

19. If (e is NS) and (ec is PS) then (u is Z) (1)

20. If (e is NS) and (ec is PM) then (u is NS) (1)

21. If (e is NS) and (ec is PB) then (u is NS) (1)

22. If (e is Z) and (ec is NB) then (u is PM) (1)

23. If (e is Z) and (ec is NM) then (u is PS) (1)

24. If (e is Z) and (ec is NS) then (u is PS) (1)

25. If (e is Z) and (ec is Z) then (u is Z) (1)

26. If (e is Z) and (ec is PS) then (u is NS) (1)

27. If (e is Z) and (ec is PM) then (u is NS) (1)

28. If (e is Z) and (ec is PB) then (u is NM) (1)

29. If (e is PS) and (ec is NB) then (u is PS) (1)

30. If (e is PS) and (ec is NM) then (u is PS) (1)

31. If (e is PS) and (ec is NS) then (u is Z) (1)

32. If (e is PS) and (ec is Z) then (u is NS) (1)

33. If (e is PS) and (ec is PS) then (u is NS) (1)

34. If (e is PS) and (ec is PM) then (u is NM) (1)

35. If (e is PS) and (ec is PB) then (u is NM) (1)

36. If (e is PM) and (ec is NB) then (u is PS) (1)

37. If (e is PM) and (ec is NM) then (u is PS) (1)

38. If (e is PM) and (ec is NS) then (u is Z) (1)

39. If (e is PM) and (ec is Z) then (u is NS) (1)

40. If (e is PM) and (ec is PS) then (u is NM) (1)

41. If (e is PM) and (ec is PM) then (u is NM) (1)

42. If (e is PM) and (ec is PB) then (u is NB) (1)

43. If (e is PB) and (ec is NB) then (u is Z) (1)

44. If (e is PB) and (ec is NM) then (u is NS) (1)

45. If (e is PB) and (ec is NS) then (u is NS) (1)

46. If (e is PB) and (ec is Z) then (u is NM) (1)

47. If (e is PB) and (ec is PS) then (u is NM) (1)

48. If (e is PB) and (ec is PM) then (u is NB) (1)

49. If (e is PB) and (ec is PB) then (u is NB) (1)

第三:控制闭环的设计

通常,一个传统的模糊控制器的闭环结构如下所示:

模糊控制器的基本结构:

3.部分源码

addpath 'func\'title_function%初始化
fnn_parameter;%被控对象
a1        = 1.2;
b1        = 1;
b2        = 0.8;
b3        = 0;ta        = 40;
sys       = tf(a1,[b1,b2,b3]);
dsys      = c2d(sys,0.1,'z');
[num,den] = tfdata(dsys,'v');
ts        = 0.1;%采样时间T=0.1%闭环控制器
for k=1:SIM_timesktime(k) = k*ts;%定义输入信号yd(k)   = 2;  %定义输出信号if k < tayn = 0; elseyn = -den(2)*y1 - den(3)*y2 + num(2)*u1 + num(3)*u2;end    y2   = y1;y1   = yn;y(k) = yn;u2   = u1;e2   = e1;e1   = yd(k)-yn;e(k) = e1;ec   =(e1-e2);x1   =(1-exp(-10*e1))/(1+exp(-10*e1));x2   =(1-exp(-ec))/(1+exp(-ec));%第1层输出for i=1:7o11(i) = x1;o12(i) = x2;endo1=[o11;o12];%第2层输出for i=1:2for j=1:7z1(i,j)  =-((o1(i,j)-a(i,j))^2)/(b(i,j));o2(i,j)  =  exp(z1(i,j));endend%第3层输出for j=1:7for l=1:7o3((j-1)*7+l)=o2(1,j)*o2(2,l);endend%第4层输出I=0;for i=1:49I = I + o3(i)*Weight(i)/4;endo4   = I/(sum(o3));u(k) = o4;u1   = o4;%梯度下降法调整权值for i=1:49dwp       =  e1*du*o3(i)/(sum(o3));%迭代Weight(i) =  Weight(i) + eta*dwp;end%中心值更新da11=zeros(1,7);for j=1:7for l=1:7da11(j) =  da11(j)+(o2(2,l)*((Weight((j-1)*7+l)*sum(o3))-I));endda12(1,j)   = -e1*du*(2*(o1(1,j)-a(1,j))*(o2(1,j)))/((b(1,j)^2)*(sum(o3))^2);da1(j)      = (da12(1,j))*(da11(j));endda21 = zeros(1,7);for j=1:7for l=1:7da21(j) = da21(j)+(o2(1,l)*((Weight((l-1)*7+j)*sum(o3))-I));endda22(2,j) = -e1*du*(2*(o1(2,j)-a(2,j))*(o2(2,j))/((b(2,j)^2)*(sum(o3))^2));da2(j)    = (da22(2,j))*(da21(j));end      da=[da1;da2];for i=1:2for j=1:7a(i,j)=a(i,j)-eta*da(i,j);endend             a_s(:,:,k) = a;if k == 1a_(:,:,k) = a_s(:,:,1);elsefor i = 1:2for j = 1:7dist_tmp(i,j) = (a_s(i,j,k) - a_(i,j))^2;endenddist = sqrt(sum(sum(dist_tmp))); if dist < 0.1tmps(:,:,1) = a_(:,:,k-1);tmps(:,:,2) = a_s(:,:,k);a_(:,:,k) = mean(tmps(:,:,1:2),3);elsea_(:,:,k) = a_(:,:,k-1);endenda = a_(:,:,k);%宽度更新db11=zeros(1,7);for j=1:7for l=1:7db11(j)=db11(j)+(o2(2,l)*((Weight((j-1)*7+l)*sum(o3))-I));enddb12(1,j)=-e1*du*(2*(o1(1,j)-a(1,j))^2)*(o2(1,j))/((b(1,j)^3)*(sum(o3))^2);db1(j)=(db12(1,j))*(db11(j));enddb21=zeros(1,7);for j=1:7for l=1:7db21(j)=db21(j)+(o2(1,l)*((Weight((l-1)*7+j)*sum(o3))-I));enddb22(2,j)=-e1*du*(2*(o1(2,j)-a(2,j))^2)*(o2(2,j))/((b(2,j)^3)*(sum(o3))^2);db2(j)=(db22(2,j))*(db21(j));end      db=[db1;db2];for i=1:2for j=1:7b(i,j)=b(i,j)-eta*db(i,j);endend      b_s(:,:,k) = b;if k == 1b_(:,:,k) = b_s(:,:,1);elsefor i = 1:2for j = 1:7dist_tmp(i,j) = (b_s(i,j,k) - b_(i,j))^2;endenddist = sqrt(sum(sum(dist_tmp))); if dist < 0.1tmps(:,:,1) = b_(:,:,k-1);tmps(:,:,2) = b_s(:,:,k);b_(:,:,k) = mean(tmps(:,:,1:2),3);elseb_(:,:,k) = b_(:,:,k-1);endend    b = b_(:,:,k);%算法s11 = y1;s12 = y2;s13 = u1;s14 = u2;s1  =[s11;s12;s13;s14];for i=1:5net2(i) = w2(i,:)*s1 + theta2(i);s2(i)   = (1-exp(-net2(i)))/(1+exp(-net2(i)));endnet3  = w3*s2+theta3;yg    = am*(1-exp(-net3))/(1+exp(-net3));for i=1:5delta2(i)=0.5*(1-s2(i))*(1+s2(i));enddelta3=0.5*am*(1-yg/am)*(1+yg/am);for i=1:5theta22(i) = theta2(i)-theta21(i);theta21(i) = theta2(i);theta2(i)  = theta2(i)+eta1*(yn-yg)*delta3*w3(i)*delta2(i)+beta1*theta22(i);endtheta32 = theta3-theta31;theta31 = theta3;theta3  = theta3+eta1*(yn-yg)*delta3+beta1*theta32;for i=1:5for j=1:4w22(i,j) = w2(i,j)-w21(i,j);w21(i,j) = w2(i,j);w2(i,j)  = w2(i,j)-eta1*(yn-yg)*delta3*w3(i)*delta2(i)*s1(j)+beta1*w22(i,j);endw32(i) = w3(i)-w31(i);w31(i) = w3(i);w3(i)  = w3(i)-eta1*(yn-yg)*delta3*s2(i)+beta1*w32(i);enda2   = am-a1;a1   = am;am   = am+eta1*(yn-yg)*yg/am+beta1*a2;sum1 = 0;for i=1:5sum1 = sum1 + w3(i)*delta2(i)*w2(i,3);enddu = delta3*sum1;end            figure;
plot(time,y,'r', time,yd,'b');
grid onfigure;
subplot(121);
plot(a_s(1,:,SIM_times),a_s(2,:,SIM_times),'o');
grid on
axis square
subplot(122);
plot(b_s(1,:,SIM_times),b_s(2,:,SIM_times),'o');
grid on
axis squaresave Simu_Results\fnn_result.mat time ysave Simu_Results\nfis.mat a b

这里重点介绍一下模糊神经网络控制器的设计,

第一:四层化神经网络层的结构设计:

第1层:

第2层:

第3层:

第4层:

第二:利用梯度下降法进行权值更新

4.仿真结果

模糊控制效果图(模型一):

模糊控制效果图(模型二):

隶属函数如下所示:

A05-06

【模糊神经网络】基于matlab的模糊神经网络仿真相关推荐

  1. 基于matlab的运动模糊图像处理,基于matlab运动模糊图像处理

    基于matlab运动模糊图像处理 基于 MATLAB 的运动模糊图像处 理 提醒: 我参考了文献里的书目和网上的一些代码而完成的,所以误差会比较大,目前 对于从网上下载的模糊图片的处理效果很不好, 这 ...

  2. 基于matlab的bp神经网络,基于MATLAB的BP神经网络建模及系统仿真 (1)

    文章编号:1001-9944(2001)01-0034-03 基于M AT LAB 的BP 神经网络建模及系统仿真 Ξ 侯北平,卢 佩 (天津轻工业学院自动化系,天津 300222) 摘 要:将M A ...

  3. matlab聚类分析实例的博客,基于Matlab的模糊聚类分析及其应用 含实例应用.pptx

    基于Matlab的模糊聚类分析及其应用 含实例应用 1;;3;1.预备知识;定义一:(模糊)聚类分析 在科学技术,经济管理中常常需要按一定的标准(相似程度或亲疏关系)进行分类.对所研究的事物按一定标准 ...

  4. 【水位预测】基于matlab径向基神经网络地下水位预测【含Matlab源码 1939期】

    一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[水位预测]基于matlab径向基神经网络地下水位预测[含Matlab源码 1939期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方 ...

  5. 【智能控制实验】基于MATLAB的BP神经网络设计

    实验五:基于MATLAB的BP神经网络设计 一.实验要求: 重点是掌握BP神经网络的学习算法原理和代码设计方法,应用MATLAB编写BP神经网络训练方法:应用神经网络工具箱设计BP神经网络实现对输入输 ...

  6. matlab耀输,基于 Matlab的BP神经网络在太阳耀斑级别预测中的应用

    第 42卷 第 3期 2014年 5月 河南师范大学学报(自然科学版) Journal of Henan Normal University(Natural Science Edition) Z.42 ...

  7. 基于MATLAB的BR神经网络交叉验证实践

    基于MATLAB的BR神经网络交叉验证实践 在做项目需要对BR神经网络进行K-Flod交叉验证并最终得到结果,于是写了这个代码. // Author LJS clearload allData.mat ...

  8. 【智能控制实验】基于MATLAB的BP神经网络实现非线性函数拟合设计

    基于MATLAB的BP神经网络实现非线性函数拟合设计 一.实验要求: 重点是掌握BP神经网络的学习算法原理,掌握matlab工具箱设计BP神经网络拟合非线性模型的方法(m文件):掌握在图形用户界面下设 ...

  9. 模糊控制洗衣机MATLAB模型,基于matlab的洗衣机模糊控制仿真

    基于matlab的洗衣机模糊控制仿真 基于 Matlab 的洗衣机模糊控制仿真模糊洗衣机是一个多输入多输出的控制系统.在实际中,模糊推理的前件和后件之间的关系对于不同的因素有所不同.例如,肮脏程度和水 ...

  10. 基于Matlab的图像去噪算法仿真实现

    在信息化的社会里,图像在信息传播中所起的作用越来越大.所以,消除在图像采集和传输过程中而产生的噪声,保证图像受污染度最小,成了数字图像处理领域里的重要部分. 本文主要研究分析邻域平均法.中值滤波法.维 ...

最新文章

  1. 1016. Phone Bills (25)
  2. 差错控制:海明码、循环冗余校验码
  3. Python之pip命令指定安装源和版本
  4. 简单超级组计划 打造强悍手臂
  5. JavaScript:从此不再怕闭包
  6. linux网页无法连接到服务器,linux – 无法连接到SMTP服务器
  7. java初学编程题及答案_Java 入门编程题答案记录(记录)
  8. Subversion(SVN)/TortoiseSVN 的分支合并方法
  9. sql 如何设置行级锁_SQL Server 2016中的行级安全性
  10. 快速构建Windows 8风格应用5-ListView数据控件
  11. OpenCV android 开发
  12. 数据库执行自定义函数报错问题记录
  13. 拓端tecdat|R语言数量生态学冗余分析RDA分析植物多样性物种数据结果可视化
  14. 深度学习 视频目标跟踪
  15. matlab在编辑器中写完了怎么运行,在编辑器中运行测试
  16. 数字人民币真的来了 六年历程全回顾
  17. DB2 license过期解决方案
  18. Teambition使用教程
  19. .pdm打开软件powerdesigner良心文章
  20. 怎么把文件发给商家打印?如何给商家发送需打印的文件

热门文章

  1. 关于JavaScript DOM 编程艺术这本书
  2. perl语言入门学习
  3. 【产品】产品经理PM相关书籍荐读
  4. 常用ftp、tftp服务器软件
  5. 泰然的粒子编辑器~~拿过来玩玩啊
  6. Hibernate教程——我的笔记
  7. python网页抓取与按键精灵原理一样吗_按键精灵等以GUI接口为基础的程序在爬虫界的地位是怎样的?...
  8. Fiddler 4 - 抓包工作,只抓手机app的请求-转过来备忘
  9. 51单片机c语言烧录软件,51单片机烧写程序的方法
  10. 什么是北京54坐标系