声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2536|回复: 4

[工具箱] 求提供IT2FLS toolbox

[复制链接]
发表于 2012-11-7 16:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
我网路上找不到
有人可以提供IT2FLS toolbox吗?
我做研究会要使用到IT2FLS
GUI界面更好
拜托谢谢~

回复
分享到:

使用道具 举报

发表于 2012-11-30 09:42 | 显示全部楼层
是这个吗?
  1. function [y,yl,yr]=IT2FLS(x,X,Y)

  2. % y=IT2FLS(x,X,Y)
  3. % Compute the output of an IT2 FLS. Dongrui Wu (drwu09@gmail.com), 3/11/2011
  4. %
  5. % x: Input to the IT2 FLS. Assume the FLS has N consequents and 1 consequent. Then, x can be a 1*N vector
  6. %    or M*N matrix, each row corresponding to an input vector.
  7. %
  8. % X: Matrix describing the consequents part of the rulebase. Assume the rulebase has K rules:
  9. %    IF x1 is X11 and x2 is X21, THEN y is y1
  10. %    ...
  11. %    IF x1 is X1K and x2 is X2K, THEN y is yK
  12. % where X11-X2K are IT2 FSs and y1-yK are crisp intervals. Then,
  13. %      X=[MF of X11, MF of X21;
  14. %         ...
  15. %         MF of X1K, MF of X2K]
  16. % Note that each MF is represented by 9 points.
  17. %
  18. % Y: Matrix describing the consequent part of the rulebase. For the above rulebase,
  19. %    Y=[y1;
  20. %       ...
  21. %       yK];
  22. %
  23. % y: Output of the IT2 FLS. It has as many rows as x, each row is the output for the corresponding row of x.
  24. %    y=(yl+yr)/2
  25. %
  26. % yl: Lower bounds of the intervals output by the type-reducer.
  27. %
  28. % yr: Upper bounds of the intervals output by the type-reducer.
  29. %
  30. % Dongrui Wu, GE Research (drwu09@gmail.com)
  31. %

  32. if nargin<3
  33.     display('Function IT2FLS: Must have three arguments. Abort.'); return;
  34. end

  35. if size(X,1)~=size(Y,1)
  36.     display('Function IT2FLS: X must have the same number of rows as Y. Abort.'); return;
  37. end

  38. if size(x,2)~=size(X,2)/9
  39.     display('Function IT2FLS: The number of columns in x must be equal to the number of IT2 FSs in each row of X. Abort'); return;
  40. end

  41. y=zeros(size(x,1),1);
  42. yr=y; yl=y;
  43. for i=1:size(x,1)
  44.     fl=ones(1,size(X,1)); fu=fl;
  45.     for j=1:size(X,1)
  46.         for k=1:size(X,2)/9
  47.             fu(j)=fu(j)*mg(x(i,k),X(j,9*(k-1)+(1:4)));
  48.             fl(j)=fl(j)*X(j,9*k)*mg(x(i,k),X(j,9*(k-1)+(5:8)));
  49.         end
  50.     end
  51.     [y(i),yl(i),yr(i)]=EIASC(Y(:,1)',Y(:,2)',fl,fu);
  52. end


  53. function [y,yl,yr,l,r]=EIASC(Xl,Xr,Wl,Wr,needSort)

  54. %
  55. % function [y,yl,yr,l,r]=EIASC(Xl,Xr,Wl,Wr,needSort)
  56. %
  57. % function to implement the EIASC algorithm in:
  58. %
  59. % D. Wu and M. Nie, "Comparison and Practical Implementation of Type-Reduction Algorithms for Type-2
  60. % Fuzzy Sets and Systems," IEEE International Conference on Fuzzy Systems, Taipei, Taiwan, June 2011.
  61. %
  62. % Dongrui WU, GE Research (drwu09@gmail.com), 7/18/2010
  63. %
  64. % Xl: A row vector containing the lower bounds of x
  65. % Xr: A row vector containing the upper bounds of x
  66. % Wl: A row vector containing the lower bounds of w
  67. % Wr: A row vector containing the upper bounds of w
  68. % needSort: ??if at least one of Xl and Xr is not in ascending order.
  69. %           ??if both Xl and Xr are in ascending order. Default ?.?
  70. %y: (yl+yr)/2
  71. %yl: lower bound of the type-reduced output
  72. %yr: upper bound of the type-reduced output
  73. %l: switch point for yl
  74. %r: switch point for yr

  75. ly=length(Xl); XrEmpty=isempty(Xr);
  76. if XrEmpty;  Xr=Xl; end
  77. if max(Wl)==0
  78.     yl=min(Xl); yr=max(Xr);
  79.     y=(yl+yr)/2;  l=1; r=ly-1; return;
  80. end
  81. index=find(Wr<10^(-10));
  82. if length(index)==ly
  83.     yl=min(Xl); yr=max(Xr);
  84.     y=(yl+yr)/2; l=1; r=ly-1; return;
  85. end
  86. Xl(index)=[]; Xr(index)=[];
  87. Wl(index)=[]; Wr(index)=[];
  88. if nargin==4;  needSort=1; end

  89. % Compute yl
  90. if  needSort
  91.     [Xl,index]=sort(Xl); Xr=Xr(index);
  92.     Wl=Wl(index); Wr=Wr(index);
  93. end
  94. Wl2=Wl; Wr2=Wr;
  95. for i=length(Xl):-1:2 % Make Xl unique
  96.     if Xl(i)==Xl(i-1)
  97.         Wl(i)=Wl(i)+Wl(i-1);
  98.         Wr(i)=Wr(i)+Wr(i-1); Xl(i)=[];
  99.         Wl(i-1)=[]; Wr(i-1)=[];
  100.     end
  101. end
  102. ly=length(Xl);
  103. if ly==1
  104.     yl=Xl;  l=1;
  105. else
  106.     yl=Xl(end); l=1;
  107.     a=Xl*Wl'; b=sum(Wl);
  108.     while l < ly && yl > Xl(l)
  109.         a=a+Xl(l)*(Wr(l)-Wl(l));
  110.         b=b+Wr(l)-Wl(l);
  111.         yl=a/b;   l=l+1;
  112.     end
  113. end

  114. % Compute yr
  115. if ~XrEmpty && needSort==1
  116.     [Xr,index]=sort(Xr);
  117.     Wl=Wl2(index); Wr=Wr2(index);
  118. end
  119. if ~XrEmpty
  120.     for i=length(Xr):-1:2 % Make Xr unique
  121.         if Xr(i)==Xr(i-1)
  122.             Wl(i)=Wl(i)+Wl(i-1);
  123.             Wr(i)=Wr(i)+Wr(i-1); Xr(i)=[];
  124.             Wl(i-1)=[]; Wr(i-1)=[];
  125.         end
  126.     end
  127. end
  128. ly=length(Xr);
  129. if ly==1
  130.     yr=Xr; r=1;
  131. else
  132.     r=ly; yr=Xr(1);
  133.     a=Xr*Wl'; b=sum(Wl);
  134.     while r>0 && yr < Xr(r)
  135.         a=a+Xr(r)*(Wr(r)-Wl(r));
  136.         b=b+Wr(r)-Wl(r);
  137.         yr=a/b;  r=r-1;
  138.     end
  139. end
  140. y=(yl+yr)/2;


  141. function u=mg(x,xMF,uMF)

  142. % u=mg(x,xMF,uMF)
  143. % function to compute the membership grades of x on a T1 FS
  144. % Dongrui WU, GE Research (drwu09@gmail.com), 7/18/2010
  145. %
  146. % xMF: x-coordinates of the T1 FS
  147. % uMF: u-coordinates of the T1 FS; default to be [0 1 1 0]
  148. % u: membership of x on the T1 FS

  149. if nargin==2
  150.     uMF=[0 1 1 0];
  151. elseif length(xMF)~=length(uMF)
  152.     display('Function mg: xMF and uMF must have the same length. Abort.'); return;
  153. end

  154. [xMF,index]=sort(xMF); uMF=uMF(index);

  155. u=zeros(size(x));
  156. for i=1:length(x)
  157.     if x(i)<=xMF(1)
  158.         if xMF(1)==xMF(2)
  159.             u(i)=1;
  160.         end
  161.     elseif x(i)>=xMF(end)
  162.         if xMF(end-1)==xMF(end)
  163.             u(i)=1;
  164.         end
  165.     else
  166.         left=find(xMF<x(i),1,'last');     right=left+1;
  167.         u(i)=uMF(left)+(uMF(right)-uMF(left))*(x(i)-xMF(left))/(xMF(right)-xMF(left));
  168.     end
  169. end
复制代码
调用实例
  1. %% Illustrate the example in the tutorial.
  2. %% Dongrui Wu, GE Research (drwu09@gmail.com), 7/18/2010

  3. clc; clear all; close all;

  4. X=[-1.5 -1.5 -.5 1.5 -1.5 -1.5 -1.5 .5 1  -1.5 -1.5 -.5 1.5 -1.5 -1.5 -1.5 .5  1
  5.    -1.5 -1.5 -.5 1.5 -1.5 -1.5 -1.5 .5 1  -1.5   .5 1.5 1.5  -.5  1.5  1.5 1.5 1
  6.    -1.5   .5 1.5 1.5  -.5  1.5  1.5 1.5 1  -1.5 -1.5 -.5 1.5 -1.5 -1.5 -1.5 .5  1
  7.    -1.5   .5 1.5 1.5  -.5  1.5  1.5 1.5 1  -1.5   .5 1.5 1.5  -.5  1.5  1.5 1.5 1];

  8. Y=[-1 -.9; -.6 -.4; .4 .6; .9 1];

  9. x=[-.3 .6];

  10. [y, yl, yr]=IT2FLS(x,X,Y)
复制代码

评分

1

查看全部评分

发表于 2012-11-30 09:54 | 显示全部楼层
下面是两份参考资料

A Brief Tutorial on Interval Type-2 Fuzzy Sets and Systems.pdf

230.36 KB, 下载次数: 3

Comparison and Practical Implementation of Type-Reduction Algorithms for Type-2.rar

642.44 KB, 下载次数: 8

Comparison and Practical Implementation of Type-Reduction Algorithms for Type-2.rar

976.56 KB, 下载次数: 8

Comparison and Practical Implementation of Type-Reduction Algorithms for Type-2.rar

976.56 KB, 下载次数: 8

评分

1

查看全部评分

回复 支持 1 反对 0

使用道具 举报

 楼主| 发表于 2012-12-8 18:44 | 显示全部楼层
谢谢~我看看

参考资料Very Good
发表于 2012-12-9 07:13 | 显示全部楼层
本帖最后由 ChaChing 于 2012-12-9 07:17 编辑

google下可以找到!
Ref: Functions for interval type-2 fuzzy logic systems
http://www.mathworks.com/matlabc ... fuzzy-logic-systems
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-15 22:35 , Processed in 0.069641 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表