Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Fuzzy_operation

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Experiment No.

: 1
Development of Fuzzy Membership Functions, fuzzy set
Operation and fuzzy set Properties
<<AI >> Lab Manual for 5th year Industrial control Under graduate
student @ BiT
Aim:

 Implementation of Fuzzy Membership Functions and fuzzy set Properties.

Objectives:

 Provide an understanding of the basic mathematical elements of fuzzy sets.


 Understand and analyze concepts of fuzzy set.
 To use fuzzy set operations to implement current computing techniques used in fuzzy
computing.

Outcomes: They will be able to,

 Learn mathematical basis as well as the general principles of various soft computing
techniques.
 To analyze the applications using fuzzy set which uses current techniques, skills, and tools
necessary for computing.
 Understand the fuzzy arithmetic concepts.

Software Required: MATLAB


Theory and procedure:
i. Fuzzy Membership Functions
The most widely used MFs are triangular, Gaussian, bell-shaped and trapezoidal. trimf (),
trapmf (), gaussmf () and gbellmf () are built-in functions for triangular, trapezoidal, Gaussian
and bell-shaped MFs. The general forms of use with parameters are described below:
y = trimf (x, [a b c])
y = trapmf (x, [a b c d])
y = gaussmf (x, [a c])
y = gbellmf (x, [a b c])
A second set of built-in MFs sigmf (), dsigmf (), psigmf (), pimf (), zmf () and smf () are
sigmoidal, difference sigmoidal, product sigmoidal, π-shaped, Z-shaped and S-shaped
functions, respectively. The parameterized general forms are described below:
y = sigmf(x,[a c]);
y = dsigmf(x, [a1 c1 a2 c2]);

Prepared by Tsehaynesh Mulusew


1
<<AI >> Lab Manual for 5th year Industrial control Under graduate
student @ BiT
y = psigmf(x, [a1 c1 a2 c2]);
y = pimf(x, [a b c d]);
y = zmf(x, [a b]);
y = smf(x, [a b]);

Example 1:

x=0:0.01:10;
a = 1; b = 4; c = 6; d = 8; a1 = 5; a2 = 4; c1 = 3; c2 = 9; b2=7;
y11 = trimf (x, [a1 b2 c2]);
y1 = trimf (x, [a b c]);
y2 = trapmf (x, [a b c d]);
y3 = gaussmf (x, [a c]);
y4 = gbellmf (x, [a b c]);
y5 = sigmf(x, [a c]);
y6 = dsigmf(x, [a1 c1 a2 c2]);
y7 = psigmf(x, [a1 c1 a2 c2]);
y8 = pimf(x, [a b c d]);
y9 = zmf(x, [a b]);
y10 = smf(x, [a b]);
%% Ploting The above membership function on a single figure
plot (x, y1)
title('Triangular MF')
subplot(5, 2, 1)
ylim([-0.05 1.05])

subplot(5, 2, 6)
ylim([-0.05 1.05])

plot (x, y2)


title('Trapezoidal MF')
subplot(5, 2, 2)

plot (x, y3)


title('Gaussan MF')
subplot(5, 2, 3)

plot (x, y4)


title('Bell MF')
subplot(5, 2, 4)

Prepared by Tsehaynesh Mulusew


2
<<AI >> Lab Manual for 5th year Industrial control Under graduate
student @ BiT

plot (x, y5)


title('Sigmoid MF')
subplot(5, 2, 5)

plot (x, y6)


title('difference between two sigmoidal MF')
subplot(5, 2, 6)

plot (x, y7)


title('Product of two sigmoid MF')
subplot(5, 2, 7)

plot (x, y8)


title('Pi-shaped curve MF')
subplot(5, 2, 8)

plot (x, y9)


title('Z-shaped curve MF')
subplot(5, 2, 9)

plot (x, y10)


title('S-shaped curve MF')
subplot(5, 2, 10)

ii. Fuzzy Set Operation


%% %%% Fuzzy Set Membership function operation %%% %%
%% Union of two fuzzy set membership function %%% %%
y12=max(y1, y11);
plot (x, y12)

%% Intersection of two fuzzy set membership function


y12=min(y1, y11);
plot (x, y12)

%% Complement
y13=1-y1;
plot(x,y1);
hold
plot(x, y13)

Example 2:

1) Consider the following fuzzy sets:

A = {1/2 + 0.4/3 + 0.6/4 + 0.3/5} and B = {0.3/2 + 0.2/3 + 0.6/4 + 0.5/5}


Write a program to find:

Prepared by Tsehaynesh Mulusew


3
<<AI >> Lab Manual for 5th year Industrial control Under graduate
student @ BiT
i) A union B,
ii) A intersection B,
iii) A complement B.
>> % enter the two matrix A and B
A=input('enter the first matrix');
B=input('enter the second matrix');
option=input('enter the option');
%option 1 Union
%option 2 intersection
%option 3 complement
if (option==1)
u=max(A,B)
end
if (option==2)
I=min(A,B)
end
if (option==3)
option1=input('enter whether to find complement for first matrix or second matrix');
if (option1==1)
[m,n]=size(A);
q=ones(m)-A;
else
q=ones(m)-B;
end
end

Prepared by Tsehaynesh Mulusew


4
<<AI >> Lab Manual for 5th year Industrial control Under graduate
student @ BiT
Fuzzy set property:

Exercise:

1) Using MATLAB commands draw the triangular & Gaussian membership function for x =
0 to 10 with increment of 0.1. Triangular membership function is defined between [5 6 7]
& Gaussian function is defined between 2 & 4.
2) Consider three fuzzy sets and one null set:
A = {0/2 + ¼ + 0.5/6 + 0.4/8 + 0.6/10}
A = {0/2 + 0.5 + 0.7/6 + 0.8/8 + 0.4/10}
A = {0.3/2 + 0.9/4 + 0.2/6 + 0/8 + 1/10}

Prepared by Tsehaynesh Mulusew


5
<<AI >> Lab Manual for 5th year Industrial control Under graduate
student @ BiT
Write a program to implement fuzzy set operation.

3) Consider the following fuzzy sets:


A = {0.8/10 + 0.3/15 + 0.6/20 + 0.2/25}
A = {0.4/10 + 0.2/15 + 0.9/20 + 0.1/25}

Verify the Demorgan’s law for above fuzzy sets ̅̅̅̅̅̅̅̅̅̅


𝐴∪B=

A B ∪ = ∩ and A B A B ∩ = ∪ using MATLAB program

Prepared by Tsehaynesh Mulusew


6

You might also like