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

📄 tprod.m

📁 FISMAT accommodates different arithmetic operators, fuzzification and defuzzification algorithm, imp
💻 M
字号:
function inter=Tprod(s1,s2)% inter=Tprod(s1,s2)%% T-norm product intersection operators between the two% alpha level sets.%% The given sets and the returned set have the same levels.%% FSTB - Fuzzy Systems Toolbox for MATLAB% Copyright (c) 1993-1996 by Olaf Wolkenhauer% Control Systems Centre at UMIST% Manchester M60 1QD, UK%% O.Wolkenhauer 20 June 1996% Last change 20 June 1996% Note: This function has not been tested properly.if nargin==0,  s1 = [1      1     1   ;        0.75  0.75  1.25 ;        0.5   0.5   1.5  ;	0.25  0.25  1.75];  s2 = [1      2     2   ;        0.75  1.75  2.25 ;        0.5   1.5   2.5  ;	0.25  1.25  2.75];  %s2=s1;end;[nol,c]=size(s1);inter=s1;inter(:,2:c) = NaN.*ones(nol,c-1);for i=1:nol,  % Find region in which the two cuts overlap:  %    First check if they overlap at all:  if ~(s1(i,3) < s2(i,2) | s2(i,3) < s1(i,2)),    from = max(s1(i,2),s2(i,2)); % overlap left bound.    to   = min(s1(i,3),s2(i,3)); % overlap right bound.    level = s1(i,1) .* s2(i,1);     % Fit the calculated level into the given ones:    indices = find(s1(:,1) <= level);    if ~isempty(indices),      inter(min(indices),2) = from;      inter(min(indices),3) = to;    end;  else    inter(i,2) = NaN;    inter(i,3) = NaN;  end;end;% Check for levels lower than alpha=1 which are filled with NaN.% Set these levels equal to the level above;for i=2:nol,  if sum(isnan(inter(i,2:3))) == 2,    inter(i,2:3) = inter(i-1,2:3);  end;end;if nargin==0 | nargout==0,  x_max=max(s1(nol,3),s2(nol,3));  x_min=min(s1(nol,2),s2(nol,2));  from=x_min-(x_max-x_min)/100*10;  to=x_max+(x_max-x_min)/100*10;  subplot(3,1,1),plot_Lset(s1,'y');  title('Families of alpha-cuts:');  set(gca,'YTick',sort([s1(:,1);0]));  set(gca,'XTick',chop(sort([s1(:,2);s1(:,3);s2(:,2);s2(:,3)]),2));  axis([from to 0 1.2]);grid   ylabel('set1 levels');   subplot(3,1,2),plot_Lset(s2,'y');  ylabel('set2 levels');  set(gca,'YTick',sort([s1(:,1);0]));  set(gca,'XTick',chop(sort([s1(:,2);s1(:,3);s2(:,2);s2(:,3)]),2));  axis([from to 0 1.2]);grid  subplot(3,1,3),plot_Lset(inter,'r');  ylabel('Tprod');  set(gca,'YTick',sort([s1(:,1);0]));  set(gca,'XTick',chop(sort([s1(:,2);s1(:,3);s2(:,2);s2(:,3)]),2));  xlabel('Universe of discourse');  axis([from to 0 1.2]);gridend;

⌨️ 快捷键说明

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