Homework 5

advertisement
Homework 5
Problem 1 Write the formula for the COA defuzzification strategy when we have a finite universe of
discourse X = {x1, x2, x3,…xn} where x1<…<xn.
πœ‡(π‘₯)𝑖𝑠 π‘‘β„Žπ‘’ π‘šπ‘’π‘šπ‘π‘’π‘Ÿ π‘“π‘’π‘›π‘π‘‘π‘–π‘œπ‘› 𝑑𝑒𝑓𝑖𝑛𝑒𝑑 𝑏𝑦 𝑋
𝑋𝐢𝑂𝐴 =
∑𝑛𝑖=1 πœ‡(π‘₯𝑖 )π‘₯𝑖 𝑑π‘₯
∑𝑛𝑖=1 πœ‡(π‘₯𝑖 ) 𝑑π‘₯
Problem 2 Use COA, BOA and MOM defuzzification strategies to find the representative values for the
overall implied fuzzy set A defined by µA(x)=trapezoid(x, 10, 30, 50, 90)
1
0.5
0
𝑋𝐢𝑂𝐴
0
10
20
30
40
50
60
70
80
90
30 π‘₯ − 10
50
90 90 − π‘₯
∫10 (30 − 10) π‘₯ 𝑑π‘₯ + ∫30 (1)π‘₯ 𝑑π‘₯ + ∫50 (90 − 50) π‘₯ 𝑑π‘₯
=
=
= πŸ’πŸ”
30 π‘₯ − 10
50
90 90 − π‘₯
∫𝑋 πœ‡π΄ (π‘₯) 𝑑π‘₯
(1)
(
)
𝑑π‘₯
+
𝑑π‘₯
+
(
)
𝑑π‘₯
∫10 30 − 10
∫30
∫50 90 − 50
∫𝑋 πœ‡π΄ (π‘₯)π‘₯ 𝑑π‘₯
𝑋𝐡𝑂𝐴
𝑋𝐡𝑂𝐴 => ∫
max(π‘₯)
πœ‡π΄ (π‘₯)𝑑π‘₯ = ∫
min(π‘₯)
30
∫
10
πœ‡π΄ (π‘₯)𝑑π‘₯
𝑋𝐡𝑂𝐴
𝑋𝐡𝑂𝐴
50
90
π‘₯ − 10
90 − π‘₯
(1)𝑑π‘₯ = ∫ (1) 𝑑π‘₯ + ∫ (
(
) 𝑑π‘₯ + ∫
) 𝑑π‘₯
30 − 10
90
− 50
30
𝑋𝐡𝑂𝐴
50
10 + 𝑋𝐡𝑂𝐴 − 30 = 50 − 𝑋𝐡𝑂𝐴 + 20
50 + 20 + 30 − 10
𝑋𝐡𝑂𝐴 =
= πŸ’πŸ“
2
𝑋𝑀𝑂𝑀 =
∫𝑋′ (1)π‘₯ 𝑑π‘₯
∫𝑋′ (1) 𝑑π‘₯
50
=
∫30 (1)π‘₯ 𝑑π‘₯
50
∫30 (1) 𝑑π‘₯
=
800
= πŸ’πŸŽ
20
100
Problem 3
%
%
%
%
%
%
Simplified Product Fuzzy Inference Engine with Fuzzy Singleton Inputs
-4 Rule, 2 Input
-Product Inference Engine
-Gaussian and Sigmoidal membership functions
-MFs are normal (there is a max that equals 1)
-Center Average Deffuzificaition
% X and Y universes
X_universe = -5:.1:5;
Y_universe = -5:.1:5;
% Initialize output space
z_out = zeros(length(X_universe), length(Y_universe));
% Generic equations for the problem
sigmoid=@(x,a,c) (1/(1+exp(-a*(x-c))));
gaussian=@(x,s,c) exp(-1/2*((x-c)/s)^2);
% Input Membership functions
ux_small=@(x) sigmoid(x, -3, 0);
ux_large=@(x) sigmoid(x, 3, 0);
uy_small=@(y) sigmoid(y, -0.9, 0);
uy_large=@(y) sigmoid(y, 0.9, 0);
% Rule output Centers
c_negLarge=-3.5;
c_negSmall=-1.7;
c_posSmall=1.7;
c_posLarge=3.5;
% Intermediate Arrays to hold values during calculations
w=zeros(1,4); % Rule Weights
rc=zeros(1,4); % Rule Contribution
% Calculate the Rule surface by traversing through X and Y
for xIndex=1:length(X_universe),
for yIndex=1:length(Y_universe),
x=X_universe(xIndex);
y=Y_universe(yIndex);
% Rule 1 if x is small and y is small them z is negative large
w(1) = ux_small(x) * uy_small(y);
rc(1) = w(1)* c_negLarge;
% Rule 2 if x is small and y is large them z is negative small
w(2) = ux_small(x) * uy_large(y);
rc(2) = w(2)* c_negSmall;
% Rule 3 if x is large and y is small them z is positive small
w(3) = ux_large(x) * uy_small(y);
rc(3) = w(3)* c_posSmall;
% Rule 4 if x is large and y is large them z is positive large
w(4) = ux_large(x) * uy_large(y);
rc(4) = w(4)* c_posLarge;
% Deffuzify
z_out(yIndex, xIndex) = sum(rc) / sum(w);
end
end
figure(1);
mesh(X_universe, Y_universe, z_out);
axis([-5 5 -5 5 -4 4]);
box off;
title({'Product Inference Engine with Center Average Deffuzification', '4
Rules, 2 Inputs'});
xlabel('X');
ylabel('Y');
zlabel('Fuzzy System Rule Surface');
Download