Error in MATLAB code for Sugeno fuzzy system

Hello What's wrong with this code? I'm trying to write a fuzzy logic program of type Sugeno in Matlab
clc
clear
close all
warning off all
y = newfis('tipper1' , 'sugeno' ,' min' , 'max ',' min' ,'max' ,'wtaver');
%input2 service
y.Inputs(1).Name = 'service';
y.Inputs(1).Range = [0 10];
y.Inputs(1).MembershipFunctions(1).Name = 'poor';
y.Inputs(1).MembershipFunctions(1).Type = 'gaussmf';
y.Inputs(1).MembershipFunctions(1).Parameters = [1.5 0];
y.Inputs(1).MembershipFunctions(2).Name = 'good';
y.Inputs(1).MembershipFunctions(2).Type = 'gaussmf';
y.Inputs(1).MembershipFunctions(2).Parameters = [1.5 5];
y.Inputs(1).MembershipFunctions(3).Name = 'excellent';
y.Inputs(1).MembershipFunctions(3).Type = 'gaussmf';
y.Inputs(1).MembershipFunctions(3).Parameters = [1.5 10];
%input2 food
y.Inputs(2).Name = 'food';
y.Inputs(2).Range = [0 10];
y.Inputs(2).MembershipFunctions(1).Name = 'rancid';
y.Inputs(2).MembershipFunctions(1).Type = 'gaussmf';
y.Inputs(2).MembershipFunctions(1).Parameters = [1.5 0];
y.Inputs(2).MembershipFunctions(2).Name = 'delicious';
y.Inputs(2).MembershipFunctions(2).Type = 'gaussmf';
y.Inputs(2).MembershipFunctions(2).Parameters = [1.5 5];
y.Inputs(2).MembershipFunctions(3).Name = 'ffd';
y.Inputs(2).MembershipFunctions(3).Type = 'gaussmf';
y.Inputs(2).MembershipFunctions(3).Parameters = [1.5 10];
% output
y.output.Name = 'tip1';
Property assignment is not allowed when the object is empty. Use subscripted assignment to create an array element.
y.output.Range = [1 10];
y.output(1).MembershipFunctions(1).Name = 'a';
y.output(1).MembershipFunctions(1).Type = 'linear';
y.output(1).MembershipFunctions(1).Parameters =[0 0 0 9];
y.output(1).MembershipFunctions(2).Name = 'b';
y.output(1).MembershipFunctions(2).Type = 'linear';
y.output(1).MembershipFunctions(2).Parameters =[0 0 0 1];
y.output(1).MembershipFunctions(3).Name = 'c';
y.output(1).MembershipFunctions(3).Type = 'linear';
y.output(1).MembershipFunctions(3).Parameters =[0 0 0 2];
y.output(1).MembershipFunctions(4).Name = 'd';
y.output(1).MembershipFunctions(4).Type = 'linear';
y.output(1).MembershipFunctions(4).Parameters =[0 0 0 3];
y.output(1).MembershipFunctions(5).Name = 'e';
y.output(1).MembershipFunctions(5).Type = 'linear';
y.output(1).MembershipFunctions(5).Parameters =[0 0 0 4];
y.output(1).MembershipFunctions(6).Name = 'f';
y.output(1).MembershipFunctions(6).Type = 'linear';
y.output(1).MembershipFunctions(6).Parameters =[0 0 0 5];
y.output(1).MembershipFunctions(7).Name = 'h';
y.output(1).MembershipFunctions(7).Type = 'linear';
y.output(1).MembershipFunctions(7).Parameters =[0 0 0 6];
y.output(1).MembershipFunctions(8).Name = 'i';
y.output(1).MembershipFunctions(8).Type = 'linear';
y.output(1).MembershipFunctions(8).Parameters = [0 0 0 7];
y.output(1).MembershipFunctions(9).Name = 'g';
y.output(1).MembershipFunctions(9).Type = 'linear';
y.output(1).MembershipFunctions(9).Parameters = [0 0 0 8];
ruleList = [1 1 9 1 1 ; 1 2 1 1 1 ; 1 3 2 1 1 ; 2 1 3 1 1 ; 2 2 4 1 1 ;
2 3 5 1 1 ; 3 1 6 1 1 ; 3 2 7 1 1 ; 3 3 8 1 1];
y=addrule(y ,' rulelist');
y= setfis(y , 'name' , 'tipper1');
y = readfis('tipper1');
plotmf(y,'input',2);

Answers (1)

The FIS output object of y is "Outputs", not "output". It's a syntax error. The "newfis" and "setfis" commands have been removed. The "addrule" command has been renamed to "addRule".
% y = newfis('tipper1' , 'sugeno' ,' min' , 'max ',' min' ,'max' ,'wtaver');
% Note that Sugeno fuzzy systems support only "prod" implication and "sum" aggregation.
y = sugfis('Name', "tipper1", ...
'AndMethod', 'min', ...
'OrMethod', 'max')
y =
sugfis with properties: Name: "tipper1" AndMethod: "min" OrMethod: "max" ImplicationMethod: "prod" AggregationMethod: "sum" DefuzzificationMethod: "wtaver" DisableStructuralChecks: 0 Inputs: [0×0 fisvar] Outputs: [0×0 fisvar] Rules: [0×0 fisrule] See 'getTunableSettings' method for parameter optimization.
% input 1 service
y.Inputs(1).Name = 'service';
y.Inputs(1).Range = [0 10];
y.Inputs(1).MembershipFunctions(1).Name = 'poor';
y.Inputs(1).MembershipFunctions(1).Type = 'gaussmf';
y.Inputs(1).MembershipFunctions(1).Parameters = [1.5 0];
y.Inputs(1).MembershipFunctions(2).Name = 'good';
y.Inputs(1).MembershipFunctions(2).Type = 'gaussmf';
y.Inputs(1).MembershipFunctions(2).Parameters = [1.5 5];
y.Inputs(1).MembershipFunctions(3).Name = 'excellent';
y.Inputs(1).MembershipFunctions(3).Type = 'gaussmf';
y.Inputs(1).MembershipFunctions(3).Parameters = [1.5 10];
% input 2 food
y.Inputs(2).Name = 'food';
y.Inputs(2).Range = [0 10];
y.Inputs(2).MembershipFunctions(1).Name = 'rancid';
y.Inputs(2).MembershipFunctions(1).Type = 'gaussmf';
y.Inputs(2).MembershipFunctions(1).Parameters = [1.5 0];
y.Inputs(2).MembershipFunctions(2).Name = 'delicious';
y.Inputs(2).MembershipFunctions(2).Type = 'gaussmf';
y.Inputs(2).MembershipFunctions(2).Parameters = [1.5 5];
y.Inputs(2).MembershipFunctions(3).Name = 'ffd';
y.Inputs(2).MembershipFunctions(3).Type = 'gaussmf';
y.Inputs(2).MembershipFunctions(3).Parameters = [1.5 10];
% output
% y.output.Name = 'tip1';
% y.output.Range = [1 10];
y.Outputs(1).Name = 'tip1';
y.Outputs(1).Range = [1 10];
y.Outputs(1).MembershipFunctions(1).Name = 'a';
y.Outputs(1).MembershipFunctions(1).Type = 'linear';
y.Outputs(1).MembershipFunctions(1).Parameters =[0 0 9];
y.Outputs(1).MembershipFunctions(2).Name = 'b';
y.Outputs(1).MembershipFunctions(2).Type = 'linear';
y.Outputs(1).MembershipFunctions(2).Parameters =[0 0 1];
y.Outputs(1).MembershipFunctions(3).Name = 'c';
y.Outputs(1).MembershipFunctions(3).Type = 'linear';
y.Outputs(1).MembershipFunctions(3).Parameters =[0 0 2];
y.Outputs(1).MembershipFunctions(4).Name = 'd';
y.Outputs(1).MembershipFunctions(4).Type = 'linear';
y.Outputs(1).MembershipFunctions(4).Parameters =[0 0 3];
y.Outputs(1).MembershipFunctions(5).Name = 'e';
y.Outputs(1).MembershipFunctions(5).Type = 'linear';
y.Outputs(1).MembershipFunctions(5).Parameters =[0 0 4];
y.Outputs(1).MembershipFunctions(6).Name = 'f';
y.Outputs(1).MembershipFunctions(6).Type = 'linear';
y.Outputs(1).MembershipFunctions(6).Parameters =[0 0 5];
y.Outputs(1).MembershipFunctions(7).Name = 'h';
y.Outputs(1).MembershipFunctions(7).Type = 'linear';
y.Outputs(1).MembershipFunctions(7).Parameters =[0 0 6];
y.Outputs(1).MembershipFunctions(8).Name = 'i';
y.Outputs(1).MembershipFunctions(8).Type = 'linear';
y.Outputs(1).MembershipFunctions(8).Parameters = [0 0 7];
y.Outputs(1).MembershipFunctions(9).Name = 'g';
y.Outputs(1).MembershipFunctions(9).Type = 'linear';
y.Outputs(1).MembershipFunctions(9).Parameters = [0 0 8];
ruleList = [1 1 9 1 1 ;
1 2 1 1 1 ;
1 3 2 1 1 ;
2 1 3 1 1 ;
2 2 4 1 1 ;
2 3 5 1 1 ;
3 1 6 1 1 ;
3 2 7 1 1 ;
3 3 8 1 1];
% y = addrule(y, 'rulelist'); % It's "ruleList", not "rulelist"
y = addRule(y, ruleList);
% y= setfis(y, 'name', 'tipper1');
% y = readfis('tipper1');
figure
subplot(211)
plotmf(y, 'input', 1);
subplot(212)
plotmf(y, 'input', 2);
figure
gensurf(y, gensurfOptions('NumGridPoints', 51))

Categories

Tags

Asked:

on 9 Oct 2018

Answered:

about 24 hours ago

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!