You are on page 1of 3

Name: Vélez Cortés Eduardo Arturo

Group: 2MM12 Date: 20/04/2020

Practice 5: Sugeno
In this practice we use the method of sugeno to design a fuzzy logic algorithm that
describe de error input in an output curve.
The next figure shows the sugeno curve generated in the app toolbox of “Fuzzy Logic
Designer”.

And here is the comparation with the same curve generated by the code written by me.
Name: Vélez Cortés Eduardo Arturo
Group: 2MM12 Date: 20/04/2020

Here is a probe that the program works fine… we are going to introduce the input 14 and
compare both results.
Name: Vélez Cortés Eduardo Arturo
Group: 2MM12 Date: 20/04/2020

Now here is the code used to generate the program above:


%% Practice 5 "Sugeno FIS"
clear all;
close all;
clc;
%% Function definition.

[x,NB]= sigmoid(-20,-0.5,-10,20,0.1);
[x,NS]= bell(-20,2.5,1,-7.5,20,0.1);
[x,C]= bell(-20,5,1,0,20,0.1);
[x,PS]= bell(-20,2.5,1,7.5,20,0.1);
[x,PB]= sigmoid(-20,0.5,10,20,0.1);

%% Rules
for i=1:length (x)
%W vector
W = [NB(i) NS(i) C(i) PS(i) PB(i)];
%Rules
VNB = -12;
VNS = 2*x(i)+8;
VC =0.4*x(i);
VPS =2*x(i) -8;
VPB =12;
%Defuzification
V(i)=(W(1)*VNB + W(2)*VNS + W(3)*VC + W(4)*VPS + W(5)*VPB)/sum(W);
end;
%% Plot
figure('name', 'Inputs')
hold on;
plot (x,NB,'y')
plot (x,NS,'c')
plot (x,C,'m')
plot (x,PS,'b')
plot (x,PB,'g')
legend('NB','NS','C','PS','PB')
%% Plot Minimun values
figure('name', 'V')
hold on;
plot (x,V,'b')
legend('V')
p=input('Introduce the value to evaluate: ');
value=((p+20)*10);
V(value)

You might also like