在学习智能控制的过程中,发现对于matalab的Neuro-Fuzzy Designer使用方法的介绍不是很多,所以个人把自己在实践过程中的一些经验记录下来。
要求使用2014b及后面的matlab版本。
首先在matlab命令行中help anfis,可以看到genfis1和anfis的使用例程。
此程序中生成了fis,并利用数据对fis进行训练,程序很简单,在此不再详细解释。Designer的好处是不需要代码能很直观看出训练效果。
下面开始记录我的经历。
我的数据程序,大部分是无用的,只是为了保证例程的完整性,所以未删除。只需用到生成的trnData和checkData两个dat文件。
clear; X1=(0:.2:20); R1 = normrnd(0,0.01,1,101); x1=X1+R1; y1=sin(2*x1)./exp(x1/10); nummfs=5; trnData=[x1',y1']; X2=(0:.1:10); x2=X2+R1; y2=sin(2*x2)./exp(x2/10); checkData=[x2',y2']; epoch_n=100; save('test1.dat','x1','y1','-ascii'); save('check1.dat','x2','y2','-ascii'); in_fis=genfis1(trnData,nummfs,'gaussmf'); out_fis=anfis(trnData,in_fis,epoch_n); plot(x1,y1,'o',x1,evalfis(x1',out_fis),'k'); legend('Trainning Data','ANFIS Output');程序运行之后,可以看到工作区的数据。
在命令行执行anfisedit或者 neuroFuzzyDesigner,效果相同,均可调出Designer,因为matlab的文档里有说明,在R2014b之后的版本变化。
New Features, Bug Fixes
collapse all
Commands to open Fuzzy Logic Designer and Neuro-Fuzzy Designer renamed
fuzzy is renamed to fuzzyLogicDesigner. Use this command to open the Fuzzy Logic Designer app.
anfisedit is renamed to neuroFuzzyDesigner. Use this command to open the Neuro-Fuzzy Designer app.
调出Designer之后,分别从工作空间加载训练和测试数据
之后生成FIS,在此选择隶属度函数类型和个数
然后,可从左上角工具栏edit-Membership functions查看生成的隶属度函数
然后修改误差范围和训练次数,可以看到误差变化。
最后可利用test,查看模型与输入数据的对比效果。
本次只记录Designer各个模块的功能,功能很强,继续探索,继续完善。
