⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 anfis_ap1.m

📁 一个汽车的fuzzy的控制,能很好地应用FUZZY的特点
💻 M
字号:
%ANFIS training file
data=[...
   0 0 0
   0 1 1
   1 0 1
   1 1 0];
numpts=length(data(:,1));
trndata=data(1:1:numpts,:);
chkdata=data(2:2:numpts,:);
figure(1);
plot3(trndata(:,1),trndata(:,2),trndata(:,3),'o',chkdata(:,1),chkdata(:,2),chkdata(:,3),'x');
title('train data and check data before training');
nummfs=2
mftype='gbellmf';
fismat=genfis1(trndata,nummfs,mftype);
[x,mf_x]=plotmf(fismat,'input',1);
[y,mf_y]=plotmf(fismat,'input',2);
figure(2);
subplot(311)
plot(x,mf_x,'o');hold on;
plot(y,mf_y,'x');hold on;
title('The input membership function before training')
%Begin to train the membership function by ANFIS
numepochs=30;
[fismat1,trnerr,ss,fismat2,chkerr]=anfis(trndata,fismat,numepochs,NaN,chkdata);
[x,mf_x]=plotmf(fismat1,'input',1);
[y,mf_y]=plotmf(fismat1,'input',2);
subplot(312)
plot(x,mf_x);hold on;
title('The input1 membership function after training')
subplot(313)
plot(y,mf_y);hold on;
title('The input2 membership function after training')
%Evaluate the fis matrix
out=evalfis([trndata(:,1) trndata(:,2)],fismat1);
figure(3);
trndata=data(1:1:numpts,:);
chkdata=data(2:2:numpts,:);
plot3(trndata(:,1),trndata(:,2),trndata(:,3),'o',chkdata(:,1),chkdata(:,2),chkdata(:,3),'x');hold on;
plot3(trndata(:,1),trndata(:,2),out);
title('line represents that train data and check data after training');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -