• Tidak ada hasil yang ditemukan

Solved Examples

Dalam dokumen Introduction to Fuzzy Logic using MATLAB (Halaman 95-105)

Membership Functions

4.6 Solved Examples

Example 4.4.Using your own intuition and definitions of the universe of discourse, plot fuzzy membership functions for “weight of people.”

Solution.The universe of discourse is the weight of people. Let the weights be in “kg” – kilogram.

Let the linguistic variables are:

Very light – w≤30 Light – 30< w≤45 Average – 45< w≤60 Heavy – 60< w≤75 Very heavy – w >75

Representing this using triangular membership function, as shown in Fig. 4.12.

Example 4.5.Using your own intuition, plot the fuzzy membership function for the age of people.

86 4 Membership Functions

VL L A H VH

1

0 30 45 60 75

µ(x)

Fig. 4.12.Membership function of weight of people

VY Y M O VO

1

0 12 25 45 65

µ

15 30 50 60

Fig. 4.13.Membership function for age of profile

Solution.

The linguistic variables are defined as, letA denotes age in years.

(1) Very young (vy) – A <15 (2) Young (y) – 12≤A <30 (3) Middle aged (m) – 25≤A <50 (4) Old (o) – 45≤A <65 (5) Very old (vo) – 60< A

This is represented using triangular membership, as shown in Fig. 4.13.

Example 4.6.Using the inference approach, find the membership values for the triangular shapes (I

R

O

) for a triangle with angles as 45,75,60. Solution.LetU-universe of discourse is

{u:x= 75≥y= 60≥z= 45, x+y+z= 180}.

(1) Calculating membership of isosceles triangle µI

(u) = 1 1

60min (x−y, y−z)

= 1 1

60min (15,15)

= 1 1

60 ×15, µI

(x) = 10.25 = 0.75.

(2) Calculating membership of right triangle µR

(u) = 1 1

90(A−90)

= 1 1

90(7590)

= 10.166, µR

(u) = 0.833.

(3) Calculating membership of other triangle

µO

(u) = min

1−µI

i∼

(u),1−µR

(u)

= min{10.75,10.833}

= min{0.25,0.167}, µO

(x) = 0.167.

Thus the membership values are calculated

Example 4.7.The energy E of a particle spinning in a magnetic field B is given by the equation

E=µβsinθ,

where µis magnetic moment of spinning particle and θis complement angle of magnetic moment with respect to the direction of the magnetic field.

Assuming the magnetic fieldB and magnetic momentµ to be constants, the linguistic terms for the complement angle of magnetic moment are given as:

High moment (H) – θ= Π/2

Slighly high moment (SH) – θ= Π/4

No moment (–z) – θ= 0

Slightly low moment (SL) – θ=Π/4

Low moment (L) – θ=Π/2

Find the membership values using the angular fuzzy set approach for these linguistic labels and plot these values versusθ.

Solution.

The linguistic variables are given by:

High moment (H) – θ= Π/2

Slighly high moment (SH) – θ= Π/4

No moment (–z) – θ= 0

Slightly low moment (SL) – θ=Π/4

Low moment (L) – θ=Π/2

The angular fuzzy set is shown in Fig. 4.14.

Calculating the angular fuzzy membership values as shown in Table 4.3.

The plot for this calculated membership value is shown in Fig. 4.15.

88 4 Membership Functions

(H)

E-axis

z 0

SH

SL

L θ = /2

θ = /4

θ = −∏/4 θ = /4

Fig. 4.14.Angular fuzzy set

Table 4.3.Angular fuzzy membership values θ Tanθ Z= cosθ µt= (z tanθ)

Π/2 0 1

Π/4 1 0.707 0.707

0 0 1 0

Π/4 1 0.707 +0.707

Π/2 0 1

1 µz(z)

−π/2 −π/4 0 π/4 π/2

Fig. 4.15.Plot of membership function

Example 4.8.Use Matlab command line commands to display the Gaussian membership function. Given x = 0–10 with increment of 0.1 and Gaussian function is defined between 0.5 and5.

Solution.

Step 1:First enter the x value x = (0:0.1:10)’;

Step 2:enter gaussmembership function

>>y1 = gaussmf(x, [0.5 5]);

Step 3:plot the curve

>>plot(x, [y1])

Gaussian membership function 00

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

1 2 3 4 5 6 7 8 9 10

Example 4.9.Use Matlab command line commands to display the triangu- lar membership function. Given x = 0–10 with increment of 0.2 triangular membership function is defined between [3 4 5]

Solution.

Step 1:First enter the x value

>>x = (0:0.2:10)’;

Step 2:enter triangular membership function

>>y1 = trimf(x, [3 4 5]);

Step 3:plot the curve

>>plot(x,y1)

Triangular membership function 00

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

1 2 3 4 5 6 7 8 9 10

Example 4.10.Illustrate different types of generalized bell membership func- tions using Matlab program

90 4 Membership Functions Solution.

The Matlab program for illustrating bell membership function is given by:

Program

% Illustration of different generalized bell MFs x = (-10:0.4:10)’;

b = 2;c = 0;

mf1 = gbell mf(x, [2, b, c]);

mf2 = gbell mf(x, [4, b, c]);

mf3 = gbell mf(x, [6, b, c]);

mf = [mf1 mf2 mf3];

subplot(221); plot(x, mf); title(‘(a) Changing “a”’);

axis([-inf inf 0 1.2]);

a = 5;c = 0;

mf1 = gbell mf(x, [a, 1, c]);

mf2 = gbell mf(x, [a, 2, c]);

mf3 = gbell mf(x, [a, 4, c]);

mf = [mf1 mf2 mf3];

subplot(222); plot(x, mf); title(‘(b) Changing “b”’);

axis([-inf inf 0 1.2]);

a = 5;b = 2;

mf1 = gbell mf(x, [a, b, -5]);

mf2 = gbell mf(x, [a, b, 0]);

mf3 = gbell mf(x, [a, b, 5]);

mf = [mf1 mf2 mf3];

subplot(223); plot(x, mf); title(‘(c) Changing “c”’);

axis([-inf inf 0 1.2]);

c = 0;

mf1 = gbell mf(x, [4, 4, c]);

mf2 = gbell mf(x, [6, 6, c]);

mf3 = gbell mf(x, [8, 8, c]);

mf = [mf1 mf2 mf3];

subplot(224); plot(x, mf); title(‘(d) Changing “a” and “b”’);

axis([-inf inf 0 1.2]);

Output

The output membership functions for different values of a, b and c are shown in Fig. 4.16.

Summary

This chapter has described the different methods of obtaining the membership functions. The entire fuzzy system operation is based on the formation of the membership functions. The sense of reasoning is very important in forming

Fig. 4.16. Bell membership functions

the membership functions. The inference and the angular fuzzy sets are based upon the angular features. In the case of neural networks and reasoning meth- ods the memberships are tuned in a cyclic fashion and are associated with the rule structure. In genetic algorithms, improvements have been made to achieve the optimum solution. Thus by using any one of the method discussed earlier, the membership function may be formed.

Review Questions

1. State the features of membership functions.

2. Define normal and subnormal fuzzy set.

3. What is a convex fuzzy set?

4. State the properties of a convex fuzzy set.

5. How is the crossover point and the height defined based on the membership function?

6. Define fuzzy number.

7. Compare normal and convex fuzzy set.

8. Define fuzzification.

9. What are the various methods employed for the membership value assign- ment?

92 4 Membership Functions

10. Justify intuition is based on human reasoning. Give some suitable exam- ples.

11. Discuss in detail on the inference method adopted for assigning member- ship values. Give details on the concepts of triangle used.

12. How is the polling concept adopted in rank ordering method to define the membership values?

13. Give details about the method of assigning membership values using an- gular fuzzy set with example.

14. Explain the method of generating membership function by means of neural networks and genetic algorithm.

15. How is membership value assigned based on inductive reasoning?

Exercise Problems

1. Using your own intuition, develop fuzzy membership functions for the fuzzy number 3, using the following shapes: (a) right angle triangle, (b) quadrilateral, (c) Gaussian function, (d) trapezoid, and (e) isosceles triangle.

2. Using intuition, assign the membership functions for

(a) population of people, (b) employment strategy, and (c) usage of library.

3. Using the inference method, find the membership values of the triangular shapes for each of the following triangles: (a) 60, 40, 80, (b) 45, 65, 70, and (c) 75, 55, 50.

4. The following data were determined by the pairwise comparison of work preferences of 100 people. When it was compared with Software (S), 69 of persons polled preferred Hardware (H), 45 of them preferred Educational (E), 55 of them preferred Business (B) and 25 preferred Textile (T). When it was compared with hardware (H), the preferences was 58-S, 45-E, 60-B, 30-T. When it was compared with educational, 39-S, 56-H, 34-B, 25-T.

When it was compared business, the preferences was 52-S, 49-H, 38-E, 20-T. When it was compared with textile, the preferences was 69-S, 65-H, 44-E, 40-B. Using rank ordering, plot the membership function for the

“most preferred work.”

5. Using your own intuition, develop fuzzy membership functions on the real line for the fuzzy number 4, using the following function shapes:

(1) Symmetric triangle (2) Trapezoid

(3) Gaussian function

6. Using your own intuition, develop fuzzy number “approximately 4 or approximately 8” using the following function shapes:

(1) Symmetric triangle (2) Trapezoids

(3) Gaussian functions.

7. Using your own intuition and your own definition of the universe of dis- course plot fuzzy membership functions to the following variables:

(1) Height of liquid in a tank (a) Very full

(b) Full (c) Medium (d) Small

(e) Very small (2) Race of people (a) Very white (b) White

(c) Moderate (d) Black

(e) Very black (3) Age of people

(a) Very young (b) Young

(c) Middle ages (d) Old

(e) Very old

8. Using the Inference approach outlined in this chapter find the membership values for each of the triangular shapes (I

, R

, IR

, E

, R

) for each of the following

(1) 80,75,25, (2) 60,75,45, (3) 50,75,55, and (4) 45,45,90.

9. Develop membership function for trapezoidal similar to algorithm devel- oped for triangle and the function should have two independent variables hence it can be passed. For the shown in table, show the first iteration in trying to compute the membership values for input variablesx1, x2, and x3 in the output regionsR1 and R2

x1 x2 x3 R1 R2 1.0 0.5 2.3 1.0 0.0 (a) Use 3×3×1 neural network,

(b) Use 3×3×2 neural network.

10. For data shown in the following table (Table A) shows the first two itera- tion using a genetic algorithm in trying to find the optimum membership function (right triangular function S) for the input variablexand output variabley in the rule table out.

11. The following raw data were determined in a pairwise comparison of new scooter in a poll 100 people. When it was compare with Splender (S), 79 of house preferred TVS Suzuki (T) 59, preferred Hero Honda (H) and 88

94 4 Membership Functions

Table A.data

x 0 0.3 0.6 1.0

y 1 0.74 0.53 0.35

Table B. rules

x L S Z – Zero

y Z S L – Large

S – Small

preferred Enfield (E), and 67 preferred infinity (I) when (T) was compared the preferences when (T) was compared, the preferences were 21-S, 23-H, 37-H, and 45-I when H1 was compared the preferences were 15-S, 77-T, 35-E, 48-I finally when an infinity was compared the preferences were 33-S, 55-T, 52-H, and 49-E. Using rank ordering, plot the membership function for “most preferred bike.”

12. The energyE of a particle spinning is a magnetic fieldB is given by the equation

E=µB sinθ,

whereµis complement angle of magnetic moment with respect to direction of the magnetic field.

Assuming the magnetic fieldBand magnetic momentµto be constant, we propose/linguistic terms for the complement angle of magnetic moment as follows:

High moment (H) θ= Π/4

Slightly high moment (SH) θ= 3Π/4

No moment θ= 0

Slightly low moment (SL) θ= 3Π/4

Low moment (L) θ= Π/4

Find the membership values using the angular fuzzy set approach for these linguistic labels for the complement angles and plot these values versusθ.

13. Use Matlab command line commands to display the triangular mem- bership function. Given x = 0–20 with increment of 0.4 triangular membership function is defined between [6 7 8].

Dalam dokumen Introduction to Fuzzy Logic using MATLAB (Halaman 95-105)