31
Introduction to Fuzzy Control Lecture 10.1 Appendix E

Introduction to Fuzzy Control

  • Upload
    sanjiv

  • View
    112

  • Download
    2

Embed Size (px)

DESCRIPTION

Introduction to Fuzzy Control. Lecture 10.1 Appendix E. Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller Fuzzification of inputs: get_inputs() Fuzzy Inference Centroid Defuzzification. Fuzzy Logic. Normal “Crisp” logic where everything must be either True or False leads to - PowerPoint PPT Presentation

Citation preview

Page 1: Introduction to Fuzzy Control

Introduction to Fuzzy Control

Lecture 10.1Appendix E

Page 2: Introduction to Fuzzy Control

Fuzzy Control

• Fuzzy Sets• Design of a Fuzzy Controller

– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Centroid Defuzzification

Page 3: Introduction to Fuzzy Control

" So far as the laws of mathematics refer to reality, they are not certain,

And so far as they are certain, they do not refer to reality."

Albert EinsteinGeometrie und Erfahrung

Fuzzy Logic

Page 4: Introduction to Fuzzy Control

Normal “Crisp” logicwhere everything must be either

True or False leads to

PARADOXES

Page 5: Introduction to Fuzzy Control

The sentence on the other side of the line is false

The sentence on the other side of the line is false

Page 6: Introduction to Fuzzy Control

A barber has a sign that reads:“I shave everyone who doesnot shave himself”

Who shaves the barber?

Page 7: Introduction to Fuzzy Control

Fuzzy Logic

• Lotfi Zadeh - Fuzzy Sets - 1965• Membership functions

– Degree of membership between 0 and 1• Fuzzy logic operations on fuzzy sets A and B

– NOT A => 1 - A– A AND B => MIN(A,B)– A OR B => MAX (A,B)

Page 8: Introduction to Fuzzy Control

Membership Functions

Young

Age

Not Young

Page 9: Introduction to Fuzzy Control

Membership Functions

Old

Age

Not Old

Page 10: Introduction to Fuzzy Control

Membership Functions

Age

Not Old Not Young

Middle Age = Not Old AND Not Young

Page 11: Introduction to Fuzzy Control

Probabiltiy vs. Fuzziness

Probability describes the uncertainty of an event occurrence.

Fuzziness describes event ambiguity.

Whether an event occurs is RANDOM.

To what degree it occurs is FUZZY.

Page 12: Introduction to Fuzzy Control

Probability:There is a 50% chance of an applebeing in the refrigerator.

Fuzzy:There is a half an apple in therefrigerator.

Page 13: Introduction to Fuzzy Control

Fuzzy logic acknowledges and exploits the tolerance for uncertainty and imprecision.

Page 14: Introduction to Fuzzy Control

Fuzzy Control

• Fuzzy Sets• Design of a Fuzzy Controller

– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Centroid Defuzzification

Page 15: Introduction to Fuzzy Control

NM NS Z PS PM

128 174 22082360

1

Universe of discourse2550

Fuzzy Membership Functions

Page 16: Introduction to Fuzzy Control

Fuzzy Control

Map to Fuzzy Sets

Fuzzy RulesIF A AND B THEN L

**

Defuzzification

Inputs

Output

get_inputs();

fire_rules();

find_output();

Page 17: Introduction to Fuzzy Control

Algorithm for a fuzzy controller

do_forever { get_inputs(); fire_rules(); find_output(); }

Page 18: Introduction to Fuzzy Control

Fuzzy Control

• Fuzzy Sets• Design of a Fuzzy Controller

– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Centroid Defuzzification

Page 19: Introduction to Fuzzy Control

get_inputs() for i = 1, num_inputs { get_x(i); fill_weight(xi, Mi); }

Fuzzification of inputs

Page 20: Introduction to Fuzzy Control

get_inputs();Given inputs x1 and x2, find the weightvalues associated with each input membership function.

ZNM NS PS PM

X1

0.2

0.7

W = [0, 0, 0.2, 0.7, 0]

Page 21: Introduction to Fuzzy Control

Fuzzy Control

• Fuzzy Sets• Design of a Fuzzy Controller

– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Centroid Defuzzification

Page 22: Introduction to Fuzzy Control

Fuzzy Inference

if x1 is A1 and x2 is B1 then y is L1 rule 1

if x1 is A2 and x2 is B2 then y is L2 rule 2

Given the fact that

x1 is A' and x2 is B' fact

the problem is to find the conclusion

y is L' conclusion

Page 23: Introduction to Fuzzy Control

m

m

m

m

m

m

m

x1 x2

x1 x2

y

y

A1

A2

B1

B2

L1

L2

yy0

a b

w1w2

w2*L1

w1*L2

sum

w1

w2

rule 1

rule 2

L'

Fuzzy Inference

Page 24: Introduction to Fuzzy Control

m

yy0

L'

m

yy0

L'

m

yy0

L'

Maximum Sum Singletons

Comparing the MAX rule and the SUM rule

Page 25: Introduction to Fuzzy Control

Fuzzy Control

• Fuzzy Sets• Design of a Fuzzy Controller

– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Centroid Defuzzification

Page 26: Introduction to Fuzzy Control

E.5 Centroid Defuzzification The last step in the fuzzy controller shown in Figure E.7 is defuzzification. This

involves finding the centroid of the net output fuzzy set L' shown in Figures E.10 and E.11. Although we have used the MIN-MAX rule in the previous section we will begin by deriving the centroid equation for the sum rule shown in Figure E.11. This will illuminate the assumptions made in deriving the defuzzification equation that we will actually use in the fuzzy controller.

Let Li(y) be the original output membership function associated with rule i where y is the output universe of discourse (see Figure E.10.). After applying rule i this membership function will be reduced to the value

mi(y) = wiLi(y) (E.1)

where wi is the minimum weight found by applying rule i. The sum of these reduced output membership functions over all rules is then given by

M(y) = i=1

Nmi(y) (E.2)

where N is the number of rules.

Page 27: Introduction to Fuzzy Control

The crisp output value y0 is then given by the centroid of M(y) from the equation

y0 = yM(y)dy

M(y)dy (E.3)

Note that the centroid of membership function Li(y) is given by

ci = yLi(y)dy

Li(y)dy (E.4)

But Ii = Li(y)dy (E.5)

is just the area of membership function Li(y). Substituting (E.5) into (E.4) we can write

yLi(y)dy = ciIi (E.6)

Page 28: Introduction to Fuzzy Control

yM(y)dy =

yi=1

NwiLi(y) dy

= i=1

N

ywiLi(y) dy

= i=1

N wiciIi (E.7)

where (E.6) was used in the last step.

Using Eqs. (E.1) and (E.2) we can write the numerator of (E.3) as

Page 29: Introduction to Fuzzy Control

Similarly, using (E.1) and (E.2) the denominator of (E.3) can be written as

M(y)dy = i=1

NwiLi(y) dy

= i=1

N

wiLi(y) dy

= i=1

N wiIi (E.8)

where (E.5) was used in the last step. Substituting (E.7) and (E.8) into (E.3) we can write the crisp output of the fuzzy controller as

y0 =

i=1

N wiciIi

i=1

N wiIi

(E.9)

Eq. (E.9) says that we can compute the output centroid from the centroids, ci, of the individual output membership functions.

Page 30: Introduction to Fuzzy Control

Note in Eq. (E.9) the summation is over all N rules. But the number of output membership functions, Q, will, in general, be less than the number of rules, N. This means that in the sums in Eq. (E.9) there will be many terms that will have the same values of ci and Ii. For example, suppose that rules 2, 3, and 4 in the sum all have the output membership function Lk as the consequent. This means that in the sum

w2c2I2 + w3c3I3 + w4c4I4

the values ci and Ii are the same values ck and Ik because they are just the centroid and area of the kth output membership function. These three terms would then contribute the value

(w2 + w3 + w4)ckIk = WkckIk

to the sum, where

Wk = (w2 + w3 + w4)

is the sum of all weights from rules whose consequent is output membership function Lk.

Page 31: Introduction to Fuzzy Control

This means that the equation for the output value, y0, given by (E.9) can be rewritten as

y0 =

k=1

Q WkckIk

k=1

Q WkIk

(E.10)

If the area of all output membership functions, Ik are equal, then Eq. (E.10) reduces to

y0 =

k=1

Q Wkck

k=1

Q Wk

(E.11)

Eqs. (E.10) and (E.11) show that the output crisp value of a fuzzy controller can be computed by summing over only the number of output membership functions rather than over all fuzzy rules. Also, if we use Eq. (E.11) to compute the output crisp value, then we need to specify only the centroids, ck, of the output fuzzy membership functions. This is equivalent to assuming singleton fuzzy sets for the output.