📄 l_add.m
字号:
function res=L_add(s1,s2)% res=L_add(s1,s2)%% Addition of Fuzzy Numbers, s1+s2, in level-set representation.%% s1 and s2 are fuzzy quantities 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:% R.Kruse, J.Gebhardt, F.Klawonn:% "Foundations of Fuzzy Systems"% John Wiley & Sons, 1995% FSTB - Fuzzy Systems Toolbox for MATLAB% Copyright (c) 1993-1996 by Olaf Wolkenhauer% Control Systems Centre at UMIST% Manchester M60 1QD, UK% 19 June 1996% Last change: 20 June 1996 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 = size(s1,1);res=s1;for level=1:nol, res(level,2) = s1(level,2) + s2(level,2); res(level,3) = s1(level,3) + s2(level,3);end; if nargin==0 | nargout==0, x_max=max(max(s1(nol,3),s2(nol,3)),res(nol,3)); x_min=min(min(s1(nol,2),s2(nol,2)),res(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);res(:,2);res(:,3)]),2)); axis([from to 0 1.2]);grid ylabel('s1'); subplot(3,1,2),plot_Lset(s2,'y'); ylabel('s2'); set(gca,'YTick',sort([s1(:,1);0])); set(gca,'XTick',chop(sort([s1(:,2);s1(:,3);s2(:,2);s2(:,3);res(:,2);res(:,3)]),2)); axis([from to 0 1.2]);grid subplot(3,1,3),plot_Lset(res,'r'); ylabel('s1 + s2'); set(gca,'YTick',sort([s1(:,1);0])); set(gca,'XTick',chop(sort([s1(:,2);s1(:,3);s2(:,2);s2(:,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 + -