Sie sind auf Seite 1von 2

Assignment 7

MOHD AQIB 16204272

clc;
clear all;
close all;

x=-5:0.1:5;
w1=0.5; % firing Strength
w2=0.7; % firing Strength
m1 = trapmf(x,[-10 -8 -2 2]);
m2 = trapmf(x,[-5 -3 2 4]);
m3 = max(w1*m1,w2*m2);
plot(x,m3,'Linewidth',4);
title('Defuzzified output');
xlabel('Linguistic variable');
ylabel('Memembership Grade');
set(gca, 'YLim',[-1 1], 'YTick', [0 .5 1]);
% Defuzzifier
% 1. 'centroid' — Centroid of the area under the output fuzzy set.
x1 = defuzz(x,m3,'centroid')
h1=line([x1 x1], [-0.2 1.2], 'color', 'k');
t1= text(x1, -0.2, 'Centroid', 'FontWeight', 'bold');
% 2. 'bisector' — Bisector of the area under the output fuzzy set
x2 = defuzz(x,m3,'bisector')
h2=line([x2 x2], [-0.4 1.2], 'color', 'r');
t2= text(x2, -0.4, 'bisector', 'FontWeight', 'bold');
% 3. 'mom' — Mean of the values for which the output fuzzy set is maximum
x3 = defuzz(x,m3,'mom')
h3=line([x3 x3], [-0.6 1.2], 'color', 'g');
t3= text(x3, -0.6, 'mom', 'FontWeight', 'bold');
% 4. 'lom' — Largest value for which the output fuzzy set is maximum
x4 = defuzz(x,m3,'lom')
h4=line([x4 x4], [-0.8 1.2], 'color', 'y');
t4= text(x4, -0.8, 'lom', 'FontWeight', 'bold');
% 5.'som' — Smallest value for which the output fuzzy set is maximum
x5 = defuzz(x,m3,'som')
h5=line([x5 x5], [-0.9 1.2], 'color', 'm');
t5= text(x5, -0.9, 'som', 'FontWeight', 'bold');
% 6. BADD (basic defuzzification distributions)
x6=badd(x,m3);
h6=line([x6 x6], [-1 1.2], 'color', 'c');
t6= text(x6, -1, 'badd', 'FontWeight', 'bold');

x1 =

-0.7937

x2 =
-0.8000

x3 =

-0.5000

x4 =

-3

x5 =

END

Das könnte Ihnen auch gefallen