1.完整项目描述和程序获取
>面包多安全交易平台:https://mbd.pub/o/bread/Y52clZpq
>如果链接失效,可以直接打开本站店铺搜索相关店铺:
>如果链接失效,程序调试报错或者项目合作也可以加微信或者QQ联系。
2.部分仿真图预览
3.算法概述
模糊控制将人的经验知识转化为控制策略,不要求精确的数学模型,只需现场操作人员的经验知识,使模型难以确定的系统得以有效的控制,因此在对象参数发生变化的时候,模糊控制仍能达到较为满意的控制效果。但模糊控制的控制作用较粗糙,无法从根本上消除静态误差,控制精度较低,于是把模糊控制整合到PID控制器中,既保持了PID控制器的结构简单、适用性强和整定方便等优点,又通过智能技术调整了PID控制器的参数,以适应被控对象特性的变化。考虑到控制规则的灵活与细致性兼顾其简单与易行的要求,这里选取七个语言等级作为本文所设计的模糊控制器的语言等级,从负的最大到正的最大依次为:负大(NB)、负中(NM)、负小(NS)、零(ZO)、正小(PS)、正中(PM)、正大(PB)。
4.部分源码
..............................................................................
fuzzyrules=[-1 -1 -1 -1 -1 -1 -0.8 -0.6 -0.4 -0.2 0;
-1 -1 -1 -1 -1 -0.8 -0.6 -0.4 -0.2 0 0.2;
-1 -1 -1 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4;
-1 -1 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6;
-1 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8;
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1;
-0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1;
-0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1 1;
-0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1 1 1;
-0.2 0 0.2 0.4 0.6 0.8 1 1 1 1 1;
0 0.2 0.4 0.6 0.8 1 1 1 1 1 1]*gu*gf;
% Next, we define some parameters for the fuzzy inverse model
gye=1/2;,gyc=1/2;
gp=0.2;
numye=11; % Number of input membership functions for the ye
% universe of discourse
numyc=11; % Number of input membership functions for the yc
% universe of discourse
wye=0.2*(1/gye); % Sets the width of the membership functions for
% ye from center to extremes
wyc=0.2*(1/gyc); % Sets the width of the membership functions for
% yc from center to extremes
invbase=0.4*gp; % Sets the base of the output membership functions
cye=[-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1]*(1/gye);
% For change in error input for learning mechanism
cyc=[-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1]*(1/gyc);
.......................................................................
ym(index)=(1/(2+a_r*step))*((2-a_r*step)*ymold+...
k_r*step*(r(index)+rold));
ymold=ym(index);
rold=r(index);
c_count=0;,e_count=0; % These are used to count the number of
% non-zero mf certainitie of e and c
e=r(index)-y(index);
% Calculates the error input for the fuzzy controller
c=(e-eold)/step;
% Calculates the change in error input for the fuzzy controller
eold=e;
if e<=ce(1) % Takes care of saturation of the left-most
% membership function
mfe=[1 0 0 0 0 0 0 0 0 0 0]; % i.e., the only one on is the
%left-most one
e_count=e_count+1;,e_int=1; % One mf on, it is the
%left-most one.
elseif e>=ce(nume) % Takes care ofsaturation
%of the right-most mf
mfe=[0 0 0 0 0 0 0 0 0 0 1];
e_count=e_count+1;,e_int=nume; % One mf on, it is the
%right-most one
else % In this case the input is on the middle part of the
for i=1:nume
if e<=ce(i)
mfe(i)=max([0 1+(e-ce(i))/we]);
if mfe(i)~=0
e_count=e_count+1;
e_int=i; % This term holds the index last entry
% with a non-zero term
end
else
mfe(i)=max([0,1+(ce(i)-e)/we]);
% In thiscase the input is to the
% right ofthe center ce(i)
if mfe(i)~=0
e_count=e_count+1;
e_int=i; % This term holds the index of the
% last entry with a non-zero term
end
end
end
end
meme_count=[e_count meme_count(1:9)];
meme_int=[e_int meme_int(1:9)];
A179