%% Add Rules Using Symbolic Expressions
% Load a fuzzy inference system (FIS), and clear the existing rules.

fis = readfis('tipper');
fis.Rules = [];

%
% Specify the following rules using symbolic expressions:
% If service is poor or food is rancid then tip is cheap.
% If service is excellent and food is not rancid then tip is generous.

rule1 = "service==poor | food==rancid => tip=cheap";
rule2 = "service==excellent & food~=rancid => tip=generous";
rules = [rule1 rule2];

%
% Add the rules to the FIS.

fis2 = addRule(fis,rules);

% fis2 is equivalent to fis, except that the specified rules are added to the rule base.

fis2.Rules

%
% Copyright 2018 The MathWorks, Inc.