问题呈述

在模糊控制这门课程中,学到了与模糊数学及模糊推理相关的内容,但是并不太清楚我们在选择模糊规则时应该如何处理,是所有的规则都需要由人手工选择,还是仅需要选择其中的一部分就可以了。因此,在课程示例的基础上做了如下的探究。

设计一个以E、EC作为输入,U作为输出的模糊推理系统,令E、EC、U的隶属度函数为如下:

1 0.6 0.2 0 0 0 0 0 0
0.2 0.6 1 0.6 0.2 0 0 0 0
0 0 0.2 0.6 1 0.6 0.2 0 0
0 0 0 0 0.2 0.6 1 0.6 0.2
0 0 0 0 0 0 0.2 0.6 1

分别给定“中心十字规则”以及“最强对角线规则”作为初始规则,观察由此推导出的结果,以验证初始模糊规则库应该如何选择。

结果

中心十字规则

其中,列索引代表E,行索引代表EC,中间的数据区域代表U。1代表负大(NB),2代表负中(NM),3代表零(Z),4代表正中(PB),5代表正大(PB)。

最强对角线

结果分析

从上面的结果可以分析得出:

  1. 当提供部分规则时,其它规则可由这些规则导出;
  2. 强对角线规则作为初始规则时,推导效果较好;
  3. 在强对角线中,左下角和右上角的隶属度为零,这与人的主观判断相同,即“误差正大,但是误差速度为负大,即误差减小(趋于零)的速度最大”,此时不应有主观判断,即维持原态即可。

Additional

tight_subplot.m

function ha = tight_subplot(Nh, Nw, gap, marg_h, marg_w)

% tight_subplot creates "subplot" axes with adjustable gaps and margins
%
% ha = tight_subplot(Nh, Nw, gap, marg_h, marg_w)
%
% in: Nh number of axes in hight (vertical direction)
% Nw number of axes in width (horizontaldirection)
% gap gaps between the axes in normalized units (0...1)
% or [gap_h gap_w] for different gaps in height and width
% marg_h margins in height in normalized units (0...1)
% or [lower upper] for different lower and upper margins
% marg_w margins in width in normalized units (0...1)
% or [left right] for different left and right margins
%
% out: ha array of handles of the axes objects
% starting from upper left corner, going row-wise as in
% going row-wise as in
%
% Example: ha = tight_subplot(3,2,[.01 .03],[.1 .01],[.01 .01])
% for ii = 1:6; axes(ha(ii)); plot(randn(10,ii)); end
% set(ha(1:4),'XTickLabel',''); set(ha,'YTickLabel','') % Pekka Kumpulainen 20.6.2010 @tut.fi
% Tampere University of Technology / Automation Science and Engineering if nargin<3; gap = .02; end
if nargin<4 || isempty(marg_h); marg_h = .05; end
if nargin<5; marg_w = .05; end if numel(gap)==1;
gap = [gap gap];
end
if numel(marg_w)==1;
marg_w = [marg_w marg_w];
end
if numel(marg_h)==1;
marg_h = [marg_h marg_h];
end axh = (1-sum(marg_h)-(Nh-1)*gap(1))/Nh;
axw = (1-sum(marg_w)-(Nw-1)*gap(2))/Nw; py = 1-marg_h(2)-axh; ha = zeros(Nh*Nw,1);
ii = 0;
for ih = 1:Nh
px = marg_w(1); for ix = 1:Nw
ii = ii+1;
ha(ii) = axes('Units','normalized', ...
'Position',[px py axw axh], ...
'XTickLabel','', ...
'YTickLabel','');
px = px+axw+gap(2);
end
py = py-axh-gap(1);
end

中心十字规则

clc;
E = [1,0.6,0,0,0,0,0,0,0;0.2,0.6,1,0.6,0.2,0,0,0,0;0,0,0.2,0.6,1,0.6,0.2,0,0;0,0,0,0,0.2,0.6,1,0.6,0.2;0,0,0,0,0,0,0.2,0.6,1];
EC = E;
U = E; % ----------------------------------------------------------------------------------
% Calculate R
% Deduct relationship
% ----------------------------------------------------------------------------------
R = zeros(81,9);
for i = 1:5
A = E(i,:)';
B = EC(3,:);
C = U(i,:);
AB = min(repmat(A,1,9), repmat(B,9,1));
AB = reshape(AB, [81,1]);
RC = min(repmat(AB,1,9), repmat(C, 81,1));
R = max(R,RC);
end for i = [1,2,4,5]
A = E(3,:)';
B = EC(i,:);
C = U(i,:);
AB = min(repmat(A,1,9), repmat(B,9,1));
AB = reshape(AB, [81,1]);
RC = min(repmat(AB,1,9), repmat(C, 81,1));
R = max(R,RC);
end % ----------------------------------------------------------------------------------
% Calculate C
% Relationship induction
% ---------------------------------------------------------------------------------- C = zeros(9,5,5);
for i = 1:5
for j = 1:5
A = E(i,:)';
B = EC(j,:);
AB = min(repmat(A,1,9), repmat(B,9,1));
AB = reshape(AB, [81,1]);
C(:,i,j) = max(min(repmat(AB, 1, 9), R));
end
end % ----------------------------------------------------------------------------------
% Plot
% ----------------------------------------------------------------------------------
figure(2);clf;
x = (1:9)/9;
ha = tight_subplot(5,5,[.0 .0],[.0 .0],[.0 .0]);
for i = 1:5
for j = 1:5
axes(ha(i*5-5+j));
h = plot(x, C(:,i,j));
ylim([0,1.2]);
xlim([min(x), max(x)]);
set(gca,'XTick',[])
set(gca,'YTick',[])
end
end

最强对角线规则

clc;
E = [1,0.6,0,0,0,0,0,0,0;0.2,0.6,1,0.6,0.2,0,0,0,0;0,0,0.2,0.6,1,0.6,0.2,0,0;0,0,0,0,0.2,0.6,1,0.6,0.2;0,0,0,0,0,0,0.2,0.6,1];
EC = E;
U = E; % ----------------------------------------------------------------------------------
% Calculate R
% Deduct relationship
% ----------------------------------------------------------------------------------
R = zeros(81,9);
for i = 1:5
A = E(i,:)';
B = EC(i,:);
C = U(i,:);
AB = min(repmat(A,1,9), repmat(B,9,1));
AB = reshape(AB, [81,1]);
RC = min(repmat(AB,1,9), repmat(C, 81,1));
R = max(R,RC);
end % ----------------------------------------------------------------------------------
% Calculate C
% Relationship induction
% ---------------------------------------------------------------------------------- C = zeros(9,5,5);
for i = 1:5
for j = 1:5
A = E(i,:)';
B = EC(j,:);
AB = min(repmat(A,1,9), repmat(B,9,1));
AB = reshape(AB, [81,1]);
C(:,i,j) = max(min(repmat(AB, 1, 9), R));
end
end % ----------------------------------------------------------------------------------
% Plot
% ----------------------------------------------------------------------------------
figure(2);clf;
x = (1:9)/9;
ha = tight_subplot(5,5,[.0 .0],[.0 .0],[.0 .0]);
for i = 1:5
for j = 1:5
axes(ha(i*5-5+j));
h = plot(x, C(:,i,j));
ylim([0,1.2]);
xlim([min(x), max(x)]);
set(gca,'XTick',[])
set(gca,'YTick',[])
end
end

模糊合成的定义

设\(P\)是\(U\times V\) 上的模糊关系,\(Q\)是\(V\times W\)上的模糊关系,则\(R\)是\(U\times W\)上的模糊关系,它是\(P\circ Q\)的合成,其隶属函数被定义为

\[\mu_{R}\left(u,w\right)\Leftrightarrow\mu_{P,Q}\left(u,w\right)=\vee_{v\in V}\left\{ \mu_{P}\left(u,v\right)\wedge\mu_{Q}\left(v,w\right)\right\}
\]

若式中牌子\(\wedge\)代表“取小–\(\min\)”,\(\vee\)代表“取大–\(\max\)”,这种合成关系即为最大值\(\cdot\)最小值合成,合成关系\(R=P\circ Q\)。

示例:

\[A=\begin{bmatrix}{0.4} & {0.5} & {0.6}\\
{0.1} & {0.2} & {0.3}
\end{bmatrix},B=\begin{bmatrix}0.1 & 0.2\\
0.3 & 0.4\\
0.5 & 0.6
\end{bmatrix}.
\]

则\(A\circ B=\begin{bmatrix}0.5 & 0.6\\
0.3 & 0.3
\end{bmatrix}\), \(B\circ A=\begin{bmatrix}{0.1} & {0.2} & {0.2}\\
{0.3} & {0.3} & {0.3}\\
{0.4} & {0.5} & {0.5}
\end{bmatrix}\)。

有定义为

\[A\times B = A^\mathrm{T}\circ B.
\]

模糊推导示例

已知一个双输入单输出的模糊系统,其输入量为\(x\)和\(y\),输出量为\(z\),其输入输出的关系可用如下两条模糊规则描述:

  • \(R_{1}\):如果\(x\)是\(A_{1}\) and \(y\)是\(B_{1}\),则\(z\)是\(C_{1}\)

  • \(R_{2}\):如果\(x\)是\(A_{2}\) and \(y\)是\(B_{2}\),则\(z\)是\(C_{2}\)

\[\begin{array}{ccc}

{A_{1}}=\frac{1}{{a_{1}}}+\frac{{0.5}}{{a_{2}}}+\frac{0}{{a_{3}}} & {B_{1}}=\frac{1}{{b_{1}}}+\frac{{0.6}}{{b_{2}}}+\frac{{0.2}}{{b_{3}}} & {C_{1}}=\frac{1}{{c_{1}}}+\frac{{0.4}}{{c_{2}}}+\frac{0}{{c_{3}}}\\

{A_{2}}=\frac{0}{{a_{1}}}+\frac{{0.5}}{{a_{2}}}+\frac{1}{{a_{3}}} & {B_{2}}=\frac{{0.2}}{{b_{1}}}+\frac{{0.6}}{{b_{2}}}+\frac{1}{{b_{3}}} & {C_{2}}=\frac{0}{{c_{1}}}+\frac{{0.4}}{{c_{2}}}+\frac{1}{{c_{3}}}

\end{array}
\]



(感觉被恶心到了,不知道为什么这儿的array环境始终出不来)

现已知输入\(x\)为\(A'\), \(y\)为\(B’\),试求输出量。

\[\begin{array}{cc}

A'=\frac{{0.5}}{{a_{1}}}+\frac{1}{{a_{2}}}+\frac{{0.5}}{{a_{3}}}
& B'=\frac{{0.6}}{{b_{1}}}+\frac{1}{{b_{2}}}+\frac{{0.6}}{{b_{3}}}\\
\end{array}
\]


\[\begin{aligned}
{A_{1}}\times{B_{1}} & =A_{1}^{T}\circ{B_{1}}={\left[{\begin{array}{ccc}
1 & {0.5} & 0\end{array}}\right]^{T}}\left[{\begin{array}{ccc}
1 & {0.6} & {0.2}\end{array}}\right]\\
& =\left[{\begin{array}{ccc}
1 & {0.6} & {0.2}\\
{0.5} & {0.5} & {0.2}\\
0 & 0 & 0
\end{array}}\right]
\end{aligned}
\]

将其按行展开得(把矩阵压扁为一行向量)

\[{R_{1}}=\bar{R}_{{A_{1}}\times{B_{1}}}^{T}\wedge{C_{1}}=\left[{\begin{array}{c}
1\\
{0.6}\\
{0.2}\\
{0.5}\\
{0.5}\\
{0.2}\\
0\\
0\\
0
\end{array}}\right]\wedge\left[{\begin{array}{ccc}
1 & {0.4} & 0\end{array}}\right]=\left[{\begin{array}{ccc}
1 & {0.4} & 0\\
1 & {0.4} & 0\\
{0.2} & {0.2} & 0\\
{0.5} & {0.4} & 0\\
{0.5} & {0.4} & 0\\
{0.2} & {0.2} & 0\\
0 & 0 & 0\\
0 & 0 & 0\\
0 & 0 & 0
\end{array}}\right]
\]

同理:

\[{R_{2}}=\bar{R}_{{A_{2}}\times{B_{2}}}^{T}\wedge{C_{2}}=\left[{\begin{array}{ccc}
0 & 0 & 0\\
0 & 0 & 0\\
0 & 0 & 0\\
0 & {0.2} & {0.2}\\
0 & {0.4} & {0.5}\\
0 & {0.4} & {0.5}\\
0 & {0.2} & {0.2}\\
0 & {0.4} & {0.6}\\
0 & {0.4} & 1
\end{array}}\right]
\]

总的蕴含关系为

\[R={R_{1}}\cup{R_{2}}=\left[{\begin{array}{ccc}
1 & {0.4} & 0\\
{0.6} & {0.4} & 0\\
{0.2} & {0.2} & 0\\
{0.5} & {0.4} & {0.2}\\
{0.5} & {0.4} & {0.5}\\
{0.2} & {0.4} & {0.5}\\
0 & {0.2} & {0.2}\\
0 & {0.4} & {0.6}\\
0 & {0.4} & 1
\end{array}}\right]
\]

计算输入量的模糊集合

\[A'\text{ and }B'=A'\times B'=\left[{\begin{array}{c}
{0.5}\\
1\\
{0.5}
\end{array}}\right]\wedge\left[{\begin{array}{ccc}
{0.6} & 1 & {0.6}\end{array}}\right]=\left[{\begin{array}{ccc}
{0.5} & {0.5} & {0.5}\\
{0.6} & 1 & {0.6}\\
{0.5} & {0.5} & {0.5}
\end{array}}\right]
\]

\[\bar{R}_{A'\times B'}^{T}=\left[{\begin{array}{ccccccccc}
{0.5} & {0.5} & {0.5} & {0.6} & 1 & {0.6} & {0.5} & {0.5} & {0.5}\end{array}}\right]
\]

\[C'=\bar{R}_{A'\times B'}\circ R=\left[{\begin{array}{ccc}
{0.5} & {0.4} & {0.5}\end{array}}\right]
\]

\[C'=\frac{{0.5}}{{c_{1}}}+\frac{{0.4}}{{c_{2}}}+\frac{{0.5}}{{c_{3}}}
\]

Fuzzy模糊推导(Matlab实现)的更多相关文章

  1. java操作elasticsearch实现前缀查询、wildcard、fuzzy模糊查询、ids查询

    1.前缀查询(prefix) //prefix前缀查询 @Test public void test15() throws UnknownHostException { //1.指定es集群 clus ...

  2. 维纳滤波和编码曝光PSF去除运动模糊【matlab】

    编码曝光知识 - ostartech - 博客园 https://www.cnblogs.com/wxl845235800/p/8276362.html %%%%%%%%%%%%%%%%%%%%%%% ...

  3. 使用MATLAB生成模糊控制的离线查询表

    1.打开模糊控制工具箱,编辑输入输出变量的隶属度函数和模糊控制规则,如下图所示,导出为fuzzy_control.fis文件. 2.打开Simulink模块,建立下图所示的系统框图,两输入,一输出,处 ...

  4. es 基于match_phrase的模糊匹配原理及使用

    [版权声明]:本文章由danvid发布于http://danvid.cnblogs.com/,如需转载或部分使用请注明出处 在业务中经常会遇到类似数据库的"like"的模糊匹配需求 ...

  5. .NET平台机器学习资源汇总,有你想要的么?

    接触机器学习1年多了,由于只会用C#堆代码,所以只关注.NET平台的资源,一边积累,一边收集,一边学习,所以在本站第101篇博客到来之际,分享给大家.部分用过的 ,会有稍微详细点的说明,其他没用过的, ...

  6. 17 Great Machine Learning Libraries

    17 Great Machine Learning Libraries 08 October 2013 After wonderful feedback on my previous post on ...

  7. Lucene学习总结之八:Lucene的查询语法,JavaCC及QueryParser

    一.Lucene的查询语法 Lucene所支持的查询语法可见http://lucene.apache.org/java/3_0_1/queryparsersyntax.html (1) 语法关键字 + ...

  8. .NET平台机器学习

    .NET平台机器学习资源汇总,有你想要的么? 接触机器学习1年多了,由于只会用C#堆代码,所以只关注.NET平台的资源,一边积累,一边收集,一边学习,所以在本站第101篇博客到来之际,分享给大家.部分 ...

  9. Lucene的查询语法,JavaCC及QueryParser(1)

    http://www.cnblogs.com/forfuture1978/archive/2010/05/08/1730200.html 一.Lucene的查询语法 Lucene所支持的查询语法可见h ...

随机推荐

  1. PMBOK(第六版) PMP笔记——《十一》第十一章(项目风险管理)

    PMBOK(第六版) PMP笔记——<十一>第十一章(项目风险管理) 第十一章 风险管理: 项目的独特性导致项目充满风险,项目风险是一种不确定的事件或条件,可能发生.将 要发生,也可能不发 ...

  2. JavaScript函数总结—越努力,越幸运!

    JavaScript 函数总结 JavaScript为web的编程脚本语言. JavaScript由三部分组成:emc(语法) dom(文档对象模型) bom(浏览器对象模型). [函数的定义] 1. ...

  3. 【Spring Cloud】服务注册与发现组件——Eureka(二)

    一.Eureka原理 1.架构图 首先来看eureka的官方结构图 所有应用作为Eureka Client和Eureka Server交互,服务提供者启动时向Eureka Server注册自己的IP. ...

  4. postman-windows下newman的使用

    一.newman的安装 1.安装node.js下载https://nodejs.org/en/ C:\Users\iphauser>node -vv10.16.1C:\Users\iphause ...

  5. 如何利用Fiddler4进行Android APP / IOS APP抓包

    Fiddler抓包 1.Fiddler介绍 Fiddler是一个http协议调试代理工具,它能够记录并检查所有你的电脑和互联网之间的http通讯,设置断点,查看所有的“进出”Fiddler的数据. F ...

  6. Java线程切换(一)

    (本文由言念小文原创,转载请注明出处) 一  前言有Android开发经验的同学都清楚,UI的更新必须在主线程中进行,且主线程不能被阻塞,否则系统ANR异常.我们往往做一些数据处理是耗时操作,必须要在 ...

  7. webpack 4.x 初级学习记录

    首先声明下,本人不擅长文字表达,文采不行,所以文章中文字较少,请看代码,初级学习,不足之处请多多指教 GitHub链接 看云kancloud [TOC] webpack 4.x 安装 首先需要在全局中 ...

  8. 关于kaggle注册无法显示人机验证码问题

    最近准备做项目,需要在kaggle上下载数据集,但注册时遇到了无法显示验证图片信息的问题,我也是通过百度最终找到解决方法,所以就准备记录下来啦:下面是解决步骤: step1:下载Google访问助手 ...

  9. 用c语言实现前序创建二叉树(递归),分别用前序,中序,后序遍历,以及分别输出节点个数和叶子节点个数

    本人c语言小白一枚,近期在学习数据结构(c语言版),特写此随笔,做一些总结和分享,如有不当之处,请各位技术大牛斧正 首先我们用一个结构体来抽象树的结点,代码如下(这里我们存放的数据为char型,大家可 ...

  10. API 接口开发规范

    整体规范建议采用RESTful 方式来实施. 协议 API与用户的通信协议,总是使用HTTPs协议,确保交互数据的传输安全. 域名 应该尽量将API部署在专用域名之下.https://api.exam ...