mktipper.m

来自「最新模糊逻辑工具箱」· M 代码 · 共 34 行

M
34
字号
%MKTIPPER Build tipper FIS with commands.
%   This script shows how you would build an entire fuzzy
%   inference system from the command line.

%   Ned Gulley, 2-1-95
%   Copyright (c) 1994-98 by The MathWorks, Inc.
%   $Revision: 1.2 $  $Date: 1997/12/01 21:44:27 $

a=newfis('tipper');

% Add the first input variable
a=addvar(a,'input','service',[0 10]);
a=addmf(a,'input',1,'poor','gaussmf',[1.5 0]);
a=addmf(a,'input',1,'good','gaussmf',[1.5 5]);
a=addmf(a,'input',1,'excellent','gaussmf',[1.5 10]);

% Add the second input variable
a=addvar(a,'input','food',[0 10]);
a=addmf(a,'input',2,'rancid','trapmf',[-2 0 1 3]);
a=addmf(a,'input',2,'delicious','trapmf',[7 9 10 12]);

% Add the output variable
a=addvar(a,'output','tip',[0 30]);
a=addmf(a,'output',1,'cheap','trimf',[0 5 10]);
a=addmf(a,'output',1,'average','trimf',[10 15 20]);
a=addmf(a,'output',1,'generous','trimf',[20 25 30]);

% Add the rules
ruleList=[ ...
1 1 1 1 2 
2 0 2 1 1 
3 2 3 1 2 ];
a=addrule(a,ruleList);

⌨️ 快捷键说明

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