fuzzy logic controller failed design problem

1 view (last 30 days)
KAO CHUN YU
KAO CHUN YU on 8 Apr 2021
Answered: Sam Chak on 30 Sep 2024
This days I study a paper about to design a fuzzy logic controller by using fuzzy() ,but it have some prpblem .
I design a fuzzy logic like it. But is wrong!!!
What is the problem about my learning?

Answers (1)

Sam Chak
Sam Chak on 30 Sep 2024
The singleton (constant) output membership functions in Fig. 5 indicate that this is a Sugeno fuzzy system; however, you have inadvertently designed a Mamdani fuzzy system. In earlier releases of the Fuzzy Logic Toolbox, the Mamdani FIS is automatically created by default when you open the Fuzzy Logic Designer app. It is necessary to create a new FIS and specify that it is a "Sugeno system."
fis = sugfis('NumInputs', 2, 'NumInputMFs', 5, 'NumOutputs', 1, 'NumOutputMFs', 9)
fis =
sugfis with properties: Name: "fis" AndMethod: "prod" OrMethod: "probor" ImplicationMethod: "prod" AggregationMethod: "sum" DefuzzificationMethod: "wtaver" DisableStructuralChecks: 0 Inputs: [1x2 fisvar] Outputs: [1x1 fisvar] Rules: [1x25 fisrule] See 'getTunableSettings' method for parameter optimization.
%% Input MFs
fis.Inputs(1).Range = [-1 1];
fis.Inputs(1).MembershipFunctions(1).Parameters = [-2.0 -1.0 -0.5];
fis.Inputs(1).MembershipFunctions(2).Parameters = [-1.0 -0.5 0.0];
fis.Inputs(1).MembershipFunctions(3).Parameters = [-0.5 0.0 0.5];
fis.Inputs(1).MembershipFunctions(4).Parameters = [ 0.0 0.5 1.0];
fis.Inputs(1).MembershipFunctions(5).Parameters = [ 0.5 1.0 2.0];
fis.Inputs(2).Range = [-1 1];
fis.Inputs(2).MembershipFunctions(1).Parameters = [-2.0 -1.0 -0.5];
fis.Inputs(2).MembershipFunctions(2).Parameters = [-1.0 -0.5 0.0];
fis.Inputs(2).MembershipFunctions(3).Parameters = [-0.5 0.0 0.5];
fis.Inputs(2).MembershipFunctions(4).Parameters = [ 0.0 0.5 1.0];
fis.Inputs(2).MembershipFunctions(5).Parameters = [ 0.5 1.0 2.0];
figure
subplot(211)
plotmf(fis, 'input', 1), grid on
subplot(212)
plotmf(fis, 'input', 2), grid on
%% Output MFs
fis.outputs(1).MembershipFunctions(1).Parameters = -1.00; % NVB
fis.outputs(1).MembershipFunctions(2).Parameters = -0.75; % NB
fis.outputs(1).MembershipFunctions(3).Parameters = -0.50; % NM
fis.outputs(1).MembershipFunctions(4).Parameters = -0.25; % NS
fis.outputs(1).MembershipFunctions(5).Parameters = -0.00; % ZE
fis.outputs(1).MembershipFunctions(6).Parameters = 0.25; % PS
fis.outputs(1).MembershipFunctions(7).Parameters = 0.50; % PM
fis.outputs(1).MembershipFunctions(8).Parameters = 0.75; % PB
fis.outputs(1).MembershipFunctions(9).Parameters = 1.00; % PVB
%% fis.Rules
fis.Rules = [];
rules = [
"input1==mf1 & input2==mf1 => output1=mf1 (1)"
"input1==mf2 & input2==mf1 => output1=mf2 (1)"
"input1==mf3 & input2==mf1 => output1=mf3 (1)"
"input1==mf4 & input2==mf1 => output1=mf4 (1)"
"input1==mf5 & input2==mf1 => output1=mf5 (1)"
"input1==mf1 & input2==mf2 => output1=mf2 (1)"
"input1==mf2 & input2==mf2 => output1=mf3 (1)"
"input1==mf3 & input2==mf2 => output1=mf4 (1)"
"input1==mf4 & input2==mf2 => output1=mf5 (1)"
"input1==mf5 & input2==mf2 => output1=mf6 (1)"
"input1==mf1 & input2==mf3 => output1=mf3 (1)"
"input1==mf2 & input2==mf3 => output1=mf4 (1)"
"input1==mf3 & input2==mf3 => output1=mf5 (1)"
"input1==mf4 & input2==mf3 => output1=mf6 (1)"
"input1==mf5 & input2==mf3 => output1=mf7 (1)"
"input1==mf1 & input2==mf4 => output1=mf4 (1)"
"input1==mf2 & input2==mf4 => output1=mf5 (1)"
"input1==mf3 & input2==mf4 => output1=mf6 (1)"
"input1==mf4 & input2==mf4 => output1=mf7 (1)"
"input1==mf5 & input2==mf4 => output1=mf8 (1)"
"input1==mf1 & input2==mf5 => output1=mf5 (1)"
"input1==mf2 & input2==mf5 => output1=mf6 (1)"
"input1==mf3 & input2==mf5 => output1=mf7 (1)"
"input1==mf4 & input2==mf5 => output1=mf8 (1)"
"input1==mf5 & input2==mf5 => output1=mf9 (1)"
];
fis = addRule(fis, rules);
%% Control Surface
figure
opt = gensurfOptions(NumGridPoints=51);
gensurf(fis, opt), title('Control Surface')

Categories

Find more on Fuzzy Logic Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!