Introduction Fuzzy Logic Onelectr
Introduction Fuzzy Logic Onelectr
Introduction Fuzzy Logic Onelectr
ITS
APPLICATIONS
Dr.(Mrs.) Lini Mathew
Professor
NITTTR, Sector 26
Chandigarh
Fuzzy Logic
• Fuzzy means “blurred” or “not clear, distinct, or
precise”
• Fuzzy Logic is a form of knowledge
representation suitable for notions that cannot be
defined precisely, but which depend upon their
contexts.
Fuzzy Logic
• Multi-valued logic that follows intermediate values
to be defined between 0 and 1
• Based on natural language
• Initiated in 1965 by Lofti Zadeh, Professor,
Computer Science, University of California,
Berkeley.
Fuzzy Logic
• Conceptually easy to understand
• Flexible
• Tolerant of imprecise data
• Nonlinear functions of arbitrary complexity
can be modeled
• Built on top of the experience of experts
• Blended with conventional control techniques
Fuzzy Set
• Fuzzy Logic has its roots in the theory of
fuzzy sets.
• A fuzzy set is a set without a crisp, clearly
defined boundary.
• It can contain elements with a partial
membership function
• A classical set has a clearly defined
boundary that wholly includes or excludes
any given element.
Fuzzy Set vs Crisp Set
Crisp Set Fuzzy Set
Fuzzy Set vs Crisp Set
• X is a set of all real numbers from 1 to 10
• Universe of Discourse
• A is a set of real numbers between 5 and 8
• Crisp or Classical Set
• Membership Value 1 or 0
Fuzzy Set vs Crisp Set
• B is a set of young people
• Membership values between 0 and 1 – Fuzzy Set
Age 65 27 17 32 22 25
B 0 0.3 1 0 0.8 0.5
Fuzzy Set
• Seasons varies
more or less
continuously
Membership Functions
• Membership function (MF) is a curve that defines how
each point in the input space is mapped to a membership
value (or degree of membership) between 0 and 1 and is
often given the designation of µ.
• µA(x) is called the membership function (or MF) of x in A.
• The figure above illustrates a linguistic variable seasons
with four associated linguistic terms namely “spring",
"summer", "fall” and “winter". Each of these linguistic
terms is associated with a fuzzy set defined by a
corresponding membership function.
• Thus membership functions are subjective measures for
linguistic terms.
• There are many types of membership functions.
Types of Membership Functions
Membership Functions
• Membership functions may include multiple subsets
each representing a different degree of the linguistic
term or value.
• Multiple overlapping membership functions which
span the entire universe of discourse are useful.
Fuzzy Set Operations
• There are three basic operation on fuzzy sets: negation,
intersection, and union
• Negation
membership_value(not x)= 1- membership_value(x)
where x is the fuzzy set being negated
• Intersection
membership_value(x and y) = minimum{membership_value(x),
membership_value(y)}
where x and y are the fuzzy sets involved in the intersection
• Union
membership_value(x or y) = maximum{membership_value(x),
membership_value(y)}
where x and y are the fuzzy sets involved in the union
AB AB
AB AB
Fuzzy Set Operations
1 0.7 0.4 0 0 0
A
1 10 20 40 80 100
0.3 1.0 1.0 0.5 0.2 0
B
1 10 20 40 80 100
(i ) A B
(ii ) A B
(iii ) A
(iv ) B
(v ) A B A B
(vi ) A B A B
Properties of Fuzzy Sets
CommutativityAB = BA
AB = BA
Associativity A (BC) = (AB)C
A (BC) = (AB)C
Distributivity A(BC) = (AB)(AC)
A (BC) = (AB)(AC)
Idempotence A A = A
AA=A
Identity A = A
A X = A
A=
AX=X
Crisp Relations
• A crisp relation between two sets X, Y is a
binary relation.
• Binary relations are represented by relation
matrices and also by sagittal diagrams.
• R={(1,a) (2,c) (3,b) (4,c)}
• Sagittal Diagram
• Relation Matrix
a b c
1 1 0 0
2 0 0 1
3 0 1 0
4 0 0 1
Fuzzy Relations
• Relation between two or more fuzzy sets is
obtained by the Cartesian product.
R x, y AxB x, y min A x , B y
0.2 0.5 1
A= + + y1 y2
x1 x 2 x 3
x1 0. 2 0.2
0 . 3 0. 9 x2 0. 3 0. 5
B= +
y1 y2 x3 0. 3 0.9
Fuzzy Relations
• Relationship between the colour of a fruit, x
and the grade of maturity, y.
• x= {green, yellow, red}
y={verdant, half-mature, mature}
• Considering the relation between the linguistic
terms red and mature, and representing them
by the membership functions, a fruit can be
characterized by the property of red and
mature.
Fuzzy Relations
• Characteristics of a red and mature fruit
Fuzzy Compositions
y1 y 2 z1 z 2 z 3
R = x1 0 . 7 0 . 5 S = y1 0.9 0.6 0.2
x 2 0 .8 0 .4 y 2 0 .1 0. 7 0. 5
T = R o S - max-min composition
T (x, z ) = max {min( R (x, y), S (y, z ))}
T = R S - max-product composition
T (x, z ) = max {( R (x, y) • S (y, z ))}
24
Composition of fuzzy relations
• Example
25
Composition of fuzzy relations
• Example
26
Composition of fuzzy relations
27
Fuzzy Relations
• Three variables of interest in power transistors are the
amount of current that can be switched, the voltage that can
be switched, and the cost. The following membership
functions for power transistors were developed from
hypothetical components catalog:
0.4 0.7 1 0.8 0.6
• Average current I = { + + + + }
0.8 0.9 1 1.1 1.2
0.2 0.8 1 0.9 0.7
• Average voltage V ={ + + + + }
30 45 60 75 90
0 .5 0.6 0.7
30 0.2 0.2 0.2
45 0.4 0.8 0.5
E = 60 0.4 1.0 0.5
75 0.4 0.9 0.5
90 0.4 0.7 0.5
Logic and Fuzzy Systems
Logic is but a small part of the human capacity to
reason. It is the science of reasoning!!
Logic for humans is a way quantitatively to develop
a reasoning process that can be replicated and
manipulated with mathematical precepts.
Logic is the study of truth in logical propositions
In classical logic, this truth is binary – a proposition
is either true or false.
In fuzzy logic, all truths are partial or approximate.
Logic and Fuzzy Systems
Classical Logic
Speed = 0 Speed = 1
Fuzzy Logic
• Conjunction
P ∧ Q : x ∈ A and x ∈ B; hence, T(P ∧ Q) = min(T(P), T(Q)).
• Negation
If T(P) = 1, then T(P̅) = 0; if T(P) = 0, then T(P̅) = 1.
• Implication
(P→ Q) : x ∉ A or x ∈ B; hence, T(P→ Q) = T(P̅ ∪ Q).
• Equivalence
(P ↔ Q) : T(P ↔ Q) = 1, for T(P) = T(Q)
= 0, for T(P) ≠ T(Q)
Ex. Consider the following four propositions:
1. if 1 + 1 = 2, then 4 > 0;
2. if 1 + 1 = 3, then 4 > 0;
3. if 1 + 1 = 3, then 4 < 0;
4. if 1 + 1 = 2, then 4 < 0.
• The first three propositions are all true; the fourth is false.
• In the first two, the conclusion 4 > 0 is true regardless of the
truth of the hypothesis;
• In the third case both propositions are false, but this does not
disprove the implication;
• In the fourth case, a true hypothesis cannot produce a false
conclusion.
The compound proposition P → Q is true in all cases except
where a true antecedent P appears with a false consequent,
Q, that is, a true hypothesis cannot imply a false
conclusion.
IMPLICATION
• The classical form of the implication is true for all propositions of P and Q except for those propositions that are in
both the truth set of P and the false set of Q,
• ie.
• Linguistically equivalent to the
statement “P → Q is true” when
either “not A” or “B” is true
LOGICAL CONNETIVES
IMPLICATION
The implication operation involves two different
universes of discourse X and Y.
R = (A × B) ∪ (Ā × Y) ≡ IF A, THEN B
IF x ∈ A, where x ∈ X and A ⊂ X
THEN y ∈ B, where y ∈ Y and B ⊂ Y,
IMPLICATION
Another rule form:
IF A, THEN B, ELSE C.
Linguistically, this is
IF A, THEN B and IF Ā,THEN C.
• Disjunction
P ∨ Q : x is A or B;
T(P ∨ Q) =max(T(P), T(Q)).
• Conjunction
P ∧ Q : x is A and B;
T(P ∧ Q) = min(T(P), T(Q)).
Fuzzy Logic Connectives
• Negation
T(P̅) = 1- T(P)
• Implication
(P → Q) : x is A then x is B;
T (P → Q) = T (P̅ ∪ Q) = max(T(P̅), T(Q)).
• If x is A then y is B ie. R = (A x B) ∪(Ā x Y)
µR(x,y) = max[(µA(x) ∧ µB(y)), (1 - µA(x))]
• If x is A then y is B , else y is C
R = (A x B) ∪(Ā x C)
µR(x,y) = max[(µA(x) ∧ µB(y)), ((1 - µA(x)) ∧ µC(y))]
Fuzzy Inference
Evaluating a new invention to determine its commercial
potential.
R = (A x B) ∪(Ā x Y)
IF A, THEN B R = (A x B) ∪(Ā x Y)
Fuzzy Inference
Fuzzy Inference
IF A, THEN B, ELSE C
IF uniqueness is medium THEN market size is
medium , ELSE market size is diffuse
R = (A x B) ∪(Ā x C)
Concentrations
Dilations
Linguistic Hedges
• Another operation on linguistic fuzzy sets is known as
intensification.
• This operation acts in a combination of concentration
and dilation. It increases the degree of membership of
those elements in the set with original membership
values greater than 0.5, and it decreases the degree of
membership of those elements in the set with original
membership values less than 0.5.
• This also has the effect of making the boundaries of the
membership function steeper.
• Intensification can be expressed by numerous
algorithms proposed by Zadeh is
Linguistic Hedges
Mathematical
Hedge Expression Graphical Representation
More or less A ( x )
Somewhat A ( x )
2 [A ( x )]2
if 0 A 0.5
Indeed
1 2 [1 A ( x )]2
if 0.5 < A 1
Linguistic Hedges
• Composite terms can be formed from one or more
combinations of atomic terms, logical connectives, and
linguistic hedges.
• Parentheses may be used to change the precedence order
and ambiguities may be resolved by the use of association-
to-the-right.
• Eg. “plus very minus very small” should be interpreted as
plus (very (minus (very (small)))).
Center of Sums
This method is similar to the weighted average
method, except in the center of sums method, the
weights are the areas of the respective membership
functions whereas in the weighted average method,
the weights are individual membership values.
Defuzzification
Center of Largest Area
If the output fuzzy set has at least two convex subregions,
then the center of gravity of the convex fuzzy subregion
with the largest area is used to obtain the defuzzified value
z∗ of the output.
Temperature oC
0
-10 0 10 20 30 40
SPEED CONTROL - Fuzzification
Cloud Cover %
0
0 20 40 60 80 100
SPEED CONTROL - Fuzzification
Slow Fast
1
Speed kmph
0
0 40 80 120 160
SPEED CONTROL - Rules
Rules
•If it's Sunny and Warm, drive Fast.
•If it's Cloudy and Cool, drive Slow.
Temperature oC
0
-10 0 10 20 30 40
SPEED CONTROL – Rule Evaluation
Temperature oC
0
-10 0 10 20 30 40
SPEED CONTROL – Rule Evaluation
Cloud Cover %
0
0 20 40 60 80 100
SPEED CONTROL – Rule Evaluation
Slow Fast
1
Speed kmph
0
0 40 80 120 160
SPEED CONTROL - Defuzzification
Fuzzification
The Inverted Pendulum
Rule Evaluation
The fuzzy rules are merely a series of if-then statements. These
statements are usually derived by an expert to achieve optimum
results.
Some examples of these rules are:
i) If angle is zero and angular velocity is zero then speed is also
zero.
ii) If angle is zero and angular velocity is negative low then the
speed shall be negative low.
iii) If angle is zero and angular velocity is positive high then the
speed shall be positive high.
iv) If angle is negative high and angular velocity is zero then the
speed shall be negative high.
v) If angle is positive high and angular velocity is zero then the
speed shall be positive high.
vi) If angle is positive low and angular velocity is negative low
then the speed shall be zero.
The Inverted Pendulum
Rule Evaluation
The result patch yielded by the rule "if angle is zero and angular
velocity is zero, the speed is zero", is shaded up to that area
The Inverted Pendulum
Rule Evaluation
The result patch yielded by the rule "if
angle is zero and angular velocity is
negative low, the speed is negative low"
The result of the fuzzy controller so far is a fuzzy set (of speed). To
choose an appropriate representative value as the final output (crisp
value), defuzzification must be done. The most common
defuzzificztion method used is the center of gravity of the set.
Phone Company