您现在的位置:首页 >> 智能控制 >> 内容

基于matlab的模糊控制器仿真,通过matlab编程实现模糊规则,控制过程等

时间:2023/1/3 22:56:15 点击:

  核心提示:A179,包括程序操作录像...

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

作者:我爱C编程 来源:我爱C编程
本站最新成功开发工程项目案例
相关评论
发表我的评论
  • 大名:
  • 内容:
本类固顶
  • 没有
  • FPGA/MATLAB商业/科研类项目合作(www.store718.com) © 2025 版权所有 All Rights Reserved.
  • Email:1480526168@qq.com 站长QQ: 1480526168