introduction to fuzzy control lecture 10.1 appendix e

31
Introduction to Fuzzy Control Lecture 10.1 Appendix E

Upload: kirk-privott

Post on 16-Dec-2015

226 views

Category:

Documents


1 download

TRANSCRIPT

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

" 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

Normal “Crisp” logicwhere everything must be either

True or False leads to

PARADOXES

The sentence on the other side of the line is false

The sentence on the other side of the line is false

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

Who shaves the barber?

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)

Membership Functions

Young

Age

Not Young

Membership Functions

Old

Age

Not Old

Membership Functions

Age

Not Old Not Young

Middle Age = Not Old AND Not Young

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.

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

Fuzzy:There is a half an apple in therefrigerator.

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

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Centroid Defuzzification

NM NS Z PS PM

128 174 22082360

1

Universe of discourse2550

Fuzzy Membership Functions

Fuzzy Control

Map to Fuzzy Sets

Fuzzy RulesIF A AND B THEN L

**

Defuzzification

Inputs

Output

get_inputs();

fire_rules();

find_output();

Algorithm for a fuzzy controller

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

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Centroid Defuzzification

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

Fuzzification of inputs

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]

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Centroid Defuzzification

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

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

m

yy0

L'

m

yy0

L'

m

yy0

L'

Maximum Sum Singletons

Comparing the MAX rule and the SUM rule

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Centroid Defuzzification

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.

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)

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

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.

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.

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.