📄 l_abs.m
字号:
function res=L_abs(Lset)% res=L_abs(Lset)%% Absolute value of the fuzzy quantity Lset in level-set representation.%% The fuzzy quantity Lset is defined in terms of alpha-cuts (level sets).% The first column of both s1 and s2 define the levels that are required to be% equal. The second and third column define the alpha cut of the associated level.% In consequence only convex fuzzy quantities are allowed.%% If invoked without lefthand arguments a plot is generated. If invoked without% input parameters, an example is created.%% Reference:% D.Dubois, H.Prade:% "Possibility Theory"% Plenum Press, 1986% FSTB - Fuzzy Systems Toolbox for MATLAB% Copyright (c) 1993-1996 by Olaf Wolkenhauer% Control Systems Centre at UMIST% Manchester M60 1QD, UK% 6 August 1996% Last change: 6 August 1996 if nargin==0, %Lset = Trap2L([0 1 1 3],4); % should stay the same. %Lset = Trap2L([-3 -1 -1 0],4); % should give -Q. %Lset = Trap2L([-2 0 0 1],4); % only positive half of -Q. Lset = Trap2L([-3 1 1 4],4); % example where union of Q and -Q has a gap.end;nol = size(Lset,1);res=Lset;dummy=Lset;% Determine the negation of Q:for level=1:nol, res(level,2) = -1*Lset(level,3); res(level,3) = -1*Lset(level,2);end;gapflag = 0;% Form the union of Q and -Q:for level=1:nol, if (res(level,3) <= Lset(level,2)), % there is a gap : -Q is left to Q. dummy(level,2) = Lset(level,2); dummy(level,3) = Lset(level,3); elseif (Lset(level,3) <= res(level,2)), % there is a gap : Q is left to -Q. dummy(level,2) = res(level,2); dummy(level,3) = res(level,3); else, dummy(level,2) = min(res(level,2),Lset(level,2)); dummy(level,3) = max(res(level,3),Lset(level,3)); end;end;% Take the intersection of Q \cup -1 and [0, -\infty):for level=1:nol, res(level,2) = max(0,dummy(level,2)); res(level,3) = max(0,dummy(level,3));end; if nargin==0 | nargout==0, x_max=max(Lset(nol,3),res(nol,3)); x_min=min(Lset(nol,2),res(nol,2)); from=x_min-(x_max-x_min)/100*10; to=x_max+(x_max-x_min)/100*10; subplot(2,1,1),plot_Lset(Lset,'y'); title('Families of alpha-cuts:'); set(gca,'YTick',sort([Lset(:,1);0])); set(gca,'XTick',chop(sort([Lset(:,2);Lset(:,3);res(:,2);res(:,3)]),2)); axis([from to 0 1.2]);grid ylabel('Q'); subplot(2,1,2),plot_Lset(res,'r'); ylabel('abs(Q)'); set(gca,'YTick',sort([Lset(:,1);0])); set(gca,'XTick',chop(sort([Lset(:,2);Lset(:,3);res(:,2);res(:,3)]),2)); xlabel('Universe of discourse'); axis([from to 0 1.2]);gridend;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -