Fuzzy Set Theory
(i)
(ii)
Classical Set:- A classical set A is a collection
of elements or objects of any kind. Two methods
describing sets:
Listing method ( A{1,2,3,4,5} )
Membership rule
A x | p (x) is a predicate stating x has property p
Height of
a person
Is the predicate
that height x 1.8 m
Contd.
Fuzzy Set:- A fuzzy set is a set with a smooth
(unsharp) boundary. It is graded membership
over the interval [ 0 , 1 ] . A fuzzy set F is
defined as ordered pairs as
F x , F ( x)| x U , F ( x) [ 0, 1]
OR
F
F ( x)
, x U , F ( x) [ 0, 1]
Example : U 1, 2, 3,............20 , is a Universe of discourse.
small 11 1 2 0.9 3 0.6 4 0.3 5
Medium 0.11 0.3 2 15 0.5 8 0.2 9
Normal & Subnormal Fuzzy Set
Normal Fuzzy Set
A ( x)
A ( x)
0.5
10
20
0.5
0
10
20
A ( x)
A ( x)
Subnormal Fuzzy Set
Scaling
Clipping
0.4
x
Generated during rule based
reasoning process
Convex Fuzzy Set
Convex Fuzzy Set:- A fuzzy set A is convex
fuzzy if the membership values are strictly
monotonically
increasing
then
strictly
monotonically decreasing with increasing values of
elements in the universe.
A ( x) 1
Convex Fuzzy Set
0
z
A ( y (1 ) z ) min ( A ( y), A ( z))
y
Types of Membership Functions
Triangular Membership
Function
This membership function is
very often used in the
application of Fuzzy logic
controller.
Example: x= -3:0.1: 6; y=trimf
(x,[-1 1 4]); plot (x, y); xlabel
(trimf, p=[-1 1 4])
Trapezoidal Membership
Due to simple formulas and
computational efficiency this mf
very popular in control problem.
Example:x= -3:0.1: 6; y=trapmf
(x,[-1 1 4 5]); plot (x, y); xlabel
(trapmf, p=[-1 1 4 5])
Contd.
Gaussian Membership
Function
( x m)2
A ( x) exp
2
2
Example: x = -10:0.1:15;
y= gaussmf (x, [2 5]);
plot (x, y); xlabel ('gaussmf,
p =[2 5]')
Note: Gaussian membership
function
achieve
smoothness and it is
symmetric
about
the
center.
m & denote the the center
Note:
and width of the function.
Contd.
Bell Shaped
Membership Function
A ( x)
1
xc
1
a
2b
Adjust c & a to
vary center and width
of the function & use
b to control the
slopes at the crossing
points.
X = 0:.1:200;
Y = gbellmf (x,[20 4
120]);
Plot (x, y)
xlabel ('gbellmf, P =[20
4 120]')
Contd.
Sigmoid Function
A ( x)
1
1 e
a( x c)
Shape of the curve depends
on (a, c) parameters.
X = 0:.1:20;
y = sigmf (x,[1 10]);
plot (x, y)
xlabel ('sigmf, P =[1 10]')
* A fuzzy set A whose
support is a single point
in U with A ( x) 1
is
called a fuzzy Singleton
A ( x)
1
Basic Operation on Fuzzy Sets
Let A and B be two fuzzy sets in U with
membership function A ( x), B ( x) respectively.
A x , A ( x) , A ( x) [ 0, 1]
B x , B ( x) , B ( x) [ 0, 1]
Union ( Disjunction) : A B ( x) max[ A ( x), B ( x) ]
A ( x) B ( x)
Contd.
Inter sec tion (Conjunction): A B ( x ) min[ A ( x) , B ( x) ]
Most Popular
Complement : A ( x) 1 A ( x)
A ( x) B ( x)
* A fuzzy conjuction, also called a t norm, represrents a
generalized int er sec tion operator , while a fuzzy
disconjuction, also called a t conorm, ( s norm) represrents
a generalized union operator.
Contd.
t-norm:
(i) Fuzzy Standard Intersection
AB ( A ( x), B ( y)) min[ A ( x), B ( y) ]
(ii) Algebraic Product
AB ( A ( x), B ( y)) A ( x) B ( y)
(iii) Bounded Product
AB (A ( x), B ( y)) max 0, A ( x) B ( y) 1
Contd.
t-conorm (s-norm)
(i) Fuzzy Standard Union
AB ( A ( x), B ( y)) max[ A ( x), B ( y) ]
(ii) Algebraic Sum
AB ( A ( x), B ( y)) A ( x) B ( y) A ( x) B ( y)
(iii) Bounded Sum
AB (A ( x), B ( y)) min 1, A ( x) B ( y)
Fuzzy System
A fuzzy inference system (or fuzzy system) basically
consists of a formulation of the mapping from a given
fuzzy input set to an fuzzy output set using fuzzy
logic.
Fuzzy
Fuzzy
Fuzzy system
output
input
Step-1: Identify ranges of the inputs & outputs.
Create fuzzification (fuzzy sets) of each input and
output variable.
Step-2: Application of fuzzy operator (AND, OR,
NOT) in the IF (antecedent) part of the rule.
Contd.
Step-3: Implication from antecedent to
consequent (conclusion) is Then part of the
rule [ (i) crisp consequent (If < antecedent >
Then y = a (ii) fuzzy consequent ( If
<antecedent > Then y = A (A is Fuzzy Set)
Mamdani model) (iii) functional consequent
n
ai xi f ( x1 , x2 ,...xn )
( If <antecedent > Then y a0
i 1
Takagi-Sugeno model) ].
If antecedent Then y a
Contd.
Step-4: Aggregation of the consequent across the
rules.
Step-5: Defuzzification (it is a mapping from the
space of a fuzzy set to a space of crisp values.
Step-6: Implement the fuzzy system, test it, and
modify fuzzy rules if necessary.
Contd.
Architecture of Fuzzy Controller
Fuzzy Logic
Controller
Fuzzification
Data Base
Rule
Base
Defuzzification
Inference Engine
Dynamic
Filter
Plant
u (t )
f
Fuzzy Logic Controller Scheme
Dynamic
Filter
u (t )
Design Tips for Antecedent
Membership Function
(i) Each membership function Overlaps Only
with the closest neighboring membership
function.( Ai Aj (null set ) j i, i 1, i 1 )
For any possible input data, its membership
values in all relevant fuzzy sets should sum
equal to 1(or nearly so).( A ( x) 1 )
i
Control Design Process
(i) Selection of Control Design
Time Domain, PID
to LQ optimal
Frequency Domain,
Classical Loop shaping
to H .
(ii) Technical
Design Objectives
Steady state
error, rise time, settling time and Maximum overshoot; in
case of optimal control design
performance weights
play an important role to modify the system response.
(iii) Development of Mathematical Model from the
Physical Laws of the Systems.
Contd.
(iv) Simplification & Linearization of the Plant
Model( near an equilibrium or operating point).
(v) Selection of Controller Structure (Control
algorithm) & Parameters. This transform the
deviation in error into appropriate action in
terms of actuator position with a view to achieve
performance objectives.
Architecture of the generic fuzzy control
system:
Contd.
u (t ) u (t T ) d nu un
Fuzzy Multi-Term Controllers &
Structures
Fuzzy-PI Rule:
If e is " A" and e is " B " Then u is " D "
e
Fuzzy Rule
Base
u
Fuzzy-PI
Fuzzy-PD Rule:
z 1
If e is " A" and e is " B " Then u is " D "
e
e
Fuzzy Rule Base
Contd.
Fuzzy-PID
Fuzzy-PID Rule:
e
e
2
Fuzzy Rule
Base
If e is " A " and e is " B " and 2e is " c " Then u is " D "
Example-1:- Stabilization of Inverted
Pendulum System
Obtain of Control Law (i) Modern Control approach (ii)
Fuzzy logic Approach
Mathematical Modeling of cart &
pendulum System
Pendulum Dynamics:
F ml 2 sin
g sin cos
M m
(t )
4 m cos 2
l
3
M
Cart Dynamics :
x (t )
F ml 2 sin cos
M m
To stabilize in upright position 00 (nearly zero) & this in turn
implies that 2 can be neglected in the above expressions.
Contd.
Linearized model
Pendulum Dynamics
Cart Dynamics
F
g
F ml
M m
x (t )
(t )
4
m
m
l
3
M
Note: One can also linearize the above system by Taylor
series expansion (retaining only first order terms in the
expression.
Two coupled second-order linearized models are
then transformed into state-space form (assuming,
and position of the pendulum angle x1 & cart
position x3 are measurable & Syst. is controllable)
x1 x ; x2 x ; x3 ; x4
x1 0
x a
2 21
x3 0
x4 a41
1 0 0 x1 0
x1
x
0 0 0 x2 b2
u (t ); y 1 0 0 0 2
x3
0 0 1 x3 0
0 0 0 x4 b4
x4
x1
x2
X (t ) A X (t ) b u (t ); where u (t ) k1 k 2 k3 k 4
x3
x
4
System Parameters & Elements of
Matrices
l 1m ; M 1kg; m 0.5 kg & g 9.81
3 g ( M m)
3 g m
a21
9.81; a41
3.21;
l 4( M m) 3m
4( M m) 3m
3
3m
1
b2
0.667; b4
1
l 4( M m) 3m
M m 4( M m) 3m
0.889
System Matrices:
0
9.81
A
0
3.21
0 0
0
0.667
0 0 0
; c 1 0 0 0 ; d [0]
;b
0
0 0 1
0 0 0
0.889
Regulator Design Using PolePlacement Technique
Matlab Program to obtain controller gain K
% Stabilization of inverted pendulum using poleplacement technique
A=[0 1 0 0; 9.81 0 0 0; 0 0 0 1;-3.27 0 0 0];
B=[0;-0.667;0;0.889];
C=[1 0 0 0];
d=[0];
%Check for controllability
%Rank of controllabilty matrix(M)
%= Rank [ B AB A2 B ......... An1B ]
rank_of_M=rank(ctrb(A,B))
Contd.
%enter the desired characteristic equation
chareqn=[1 12 72 192 256]
%Calculate desired closed loop poles
desired_poles=roots(chareqn)
%Calculate feedback gain matrix ' K ' using
Ackermann's formula (K=[0 0 .1] M 1 ( A) )
K=acker(A,B,desired_poles)
Results: rank_of_M=4; chareqn= 1 12 72 192 256; -4.0
+j 4.0; -4 j 4.0; -2 +j 2 & -2 j 2.
K=[ - 174.82 -57.12 -39.14 -29.35 ]
Simulation Results ( based on poleplacement)
Either obtain the system
response through Matlab
program
or
through
Simulink.
Pendulum Angle
(rad.)
Pole Placement
PendulumVelocity
(rad./sec)
Pole Placement
Cart Position (m)
Cart Velocity (m/sec.)
Pole Placement
Pole Placement
Applied force to cart (N)
Pole Placement
Solution of Exam.-1 Using Fuzzy Logic
Controller
Two Inputs Single Output (Controller)
Fuzzy
Controller
u (t )
(i) For each input & output three linguistic terms are
considered as NB, Z & PB.
( )
( )
Z
NB
-0.1
PB
0.1
NB
-0.5
PB
0.5
Output Membership Function
(f)
Z
NB
PB
0
100
-100
To implement fuzzy controller the following Mamdanitype rule-base was constructed.
PB Then
is f PB
Z Then
is f PB
R4: If is Z and
NB Then
is f Z
PB Then
is f PB
is PB and
R2: If is PB and
R1: If
R3: If
is PB and
Contd.
R5: If is Z and Z Then is
R6: If is Z and NB Then is
R7: If is NB and
PB Then is
R8: If is NB and
Z Then is
R9: If is NB and NB Then is
R10: If PB Then is f PB
R11: If NB Then
is f NB
f Z
f NB
f Z
f NB
f NB
How to Implement Rule Fuzzy Controller using Fuzzy Inference
System (FIS) Editor, Membership editor, Fuzzy rule editor, Rule
viewer & Surface viewer.
Contd.
For the given rulebase the fuzzy and inference
process is used.
>> fuzzy
Solution of Exam.-1 Using Fuzzy Logic
Controller
Pendulum Velocity
Pendulum Angle
(rad.)
Fuzzy
Controller
(rad./sec.)
Fuzzy
Controller
Cart Position (m)
Cart Velocity
(m/sec.)
Fuzzy
Controller
Fuzzy
Controller
time
Force Applied to Cart (N)
Fuzzy
Controller
Control Surface for 11 Rule FLC
Summarize the Steps Involve in
Simulink Implementation of
Fuzzy logic Control Problem
>> fuzzy (this brings up the main menu screen)
Double-clicking on the input/output icon
brings up the membership editor.
Go to edit menu & then click Add MFs. You
can select no. of MFs according to your
requirement. Next adjust the range of variable
and select parameters of each membership
function( say, trimf(x,[1,3,5]) .
After adjusting all inputs & outputs membership
functions, Go to the main menu & double clicking
on the center box (Mamdani) will bring up the FIS
rule editor. Write all rules there only.
When editing is complete, go to file menu in the
rule editor & save to disk as a file name
pendulum.fis
The inverted pendulum fuzzy controller problem can
now be implemented in SIMULINK.
The fuzzy logic icon is obtained by opening the fuzzy
logic tool box within the simulink Library Browser, and
dragging it across.
Note, the properties of the fuzzy logic controller
have not been defined. So, at the MATLAB
prompt, type
>> fismat=readfis (this will allow you to select
from a directory a filename pendulum.fis
which is ready stored in a disk.)
This means that the fuzzy logic controller
parameters have been placed in the work space
under fismat, and one can now proceed for
simulation.
Remarks
Note: Design of conventional Controller is based
on mathematical model of a plant. Fuzzy
Controller is basically an adaptive and non-linear
control which gives robust performance for a
linear or non-linear plant with parametric
uncertainty and moreover, the controller does
not require any knowledge of mathematical
model of dynamic system.
Interpolate Between Piecewise Linear
Mappings Using Takagi-Sugeno Rules
Example-2: A linear equation is as described
below:
2 2 x
y
1 4 x
for
x 1
for
x 1
Take two fuzzy sets & they are described as
1
1 x
A1
2
0
if x 1
if x 1
0
1 x
if 1 x 1 ; A2
if 1 x 1
2
if 1 x
if 1 x
1
Contd.
A1
A2
Contd.
Rule-1:
If x1 is A1
Rule-2:
If x1 is A2
Then
Then
y1 f1 ( x1 ) 2 2 x1
y1 f 2 ( x1 ) 1 4 x1
Defuzzification (weighted Average):
A1 ( x1 ) f1 ( x1 ) A 2 ( x1 ) f 2 ( x1 )
1 1
1
y
x1 2 2 x1 x1 1 4 x1
A1 ( x1 ) A 2 ( x2 )
2 2
2
1 3
2
x1 x1
2 2
2 2 x1
1 4 x1
if
1 x1 1
if
x 1
if
x 1
T-S Fuzzy Model Based Control
The essential components of the TS are linear
local models which describe the plant dynamic
behavior at its different operating points. An
non-linear interpolation of a dynamic system
between dynamic linear systems. One can
construct a T-S model if local description of the
plant is available in terms of local linear dynamic
models.
X (i ) (t ) A(i ) X (i ) (t ) B (i )U (t ) ,
i 1, 2,......L
Contd.
th
i Rule :
IF
x1 is Ai1 And x2 is Ai 2 ... And xn is Ain
THEN
X (i ) (t ) A( i ) X (t ) B ( i )U (t )
Or X (k 1) F (i ) X (k ) G (i )U (k ); i 1, 2,...L
A non-linear interpolation between ' L ' linear systems is
presented as (Algebraic Product is used as inference
process)
L
X (t )
(i )
(i )
(
X
(
t
))[
A
X
(
t
)
B
U (t )]
i
i 1
i ( X (t ))
i 1
, where i ( X (t )) Aij ( x j )
j 1
Contd.
T
L (i )
L (i )
X (t ) A i ( X (t )) X (t ) B i ( X (t )) U (t ), where 1 2 .... L
i 1
i 1
X (t ) A X (t ) B U (t ) , Note, for i 1, 2,...... L, we have
i 0,
i 1
1, and 1 2 .... L 0, 1
T
A system model given by
X (t ) A X (t ) B U (t )
is also referred to as in the literature as the polytopic system.
Design of Fuzzy Logic Controller
(T-S Fuzzy Controller):
It is assumed that X (t ) is measurable and the
controller is another T-S fuzzy system with L
rules (same number of rules as was used to
describe the plant) of the form
IF
x1 is Ai1 And x2 is Ai 2 ... And xn is Ain
THEN
U (i ) K ( i ) X (t )
Or U (i ) (k 1) K ( i ) X (k ); i 1, 2,...L, and K
is the Control Matrix.
Note: The designed fuzzy controller shares the same fuzzy
sets with the fuzzy model in the premise parts.
Contd.
In this case,
L
U (t ) K
j 1
j ( X (t )) X (t ), where j
( j)
j ( X (t ))
L
j 1
( X (t ))
Using the above control law in X (t ) A X (t ) B U (t )
we get, the closed loop system as
L (i )
L (i )
L ( j)
X (t ) A i ( X (t )) X (t ) B i ( X (t )) K j ( X (t )) X (t )
i 1
i 1
j 1
which is in the form of X (t ) f ( X (t )). Our problem is
now to study the stability of the fuzzy log ic based
control system.
Stability Analysis Based on
LyapunovFunction
V ( X (t )) X T (t ) PX (t )
Let
is a Lyapunov function with
P>0. To check the Fuzzy closed-loop system is
globally asymptotically stable, V ( X (t )) 0, X (t )
V ( X (t )) X T (t ) P X (t ) X T (t ) P X (t )
L
L i
(
X
(
t
))
(
X
(
t
))
i
j
L
L
T
i
j
i 1
J 1
X (t ) P
B i ( X (t )) K j ( X (t )) X (t )
L
i 1
j 1
j ( X (t ))
J 1
T
i
A
(
X
(
t
))
(
X
(
t
))
i
j
L i
L j
T
i 1
J 1
X (t )
B i ( X (t )) K j ( X (t )) PX (t )
L
i 1
j 1
j ( X (t ))
J 1
L
Contd.
After simplification we get,
i
i
j
i
i
j
X (t ) i ( X (t )) j ( X (t )) A B K P P A B K X (t )
i, j
T
i
i
j
i
i
j
X (t ) A B K P P A B K X (t ), where 0 i ( X (t )) j ( X (t )) 1
i, j
For asymptotic stability the following condition must be satisfied,
A B K
i
P P Ai Bi K j 0, i 1, 2,...... L & j 1, 2,.... L
Note: We need to find out common matrix P such that the Lyapunov
equations are negative definite. Linear matrix inequality (LMI)
methods can be used to find P if it exists. A brief outline of LMI is
given below.
LMI- Problems
Definition: A LMI is linear matrixm inequality
expression of the form F ( X ) F0 xi Fi 0
i 0
where xi variables and Fi symmetric matrices
are given. The feasibility problem is to determine
the variables xi , i 1, 2,...m so that the above
Inequality holds. Multiple LMIs F (i ) 0, i 1, 2,...... p,
.
(1)
(2)
( p)
diag
F
F
.....
F
0.
can be expressed as a single LMI
Application of LMI Problems
Fuzzy Control Problem ( Discrete System)
Let us consider a discrete-time system (for one rule
only) X (k 1) AX (k ) BU (k ) for U (k ) FX (k ) is
(quadratically) stable if P 0 such that
A BF
P A BF P 0
The control problem is to find ' F ' such that the closed
loop system is stable. This stabilization problem can be
recast as an LMI problem in the following way.
P
A BF
P A BF P1 P1 0
A BF X X 1 A BF X X 0, where X P 1
T
X AX BM X 1 AX BM 0, where M FX
T
For
X 0, we have F M X 1
This nonlinear (convex) inequality can now be converted to
LMI form using Schur Complements. The resulting LMI
.
AX BM
AX BM
Thus the closed loop discrete time system is quadratically
stable if X 0 and M such that the above LMI condition holds.
The state-feedback gain is F MX 1 .
Theorem:-1 (Continuous Time Fuzzy
TS System)
If for some P 0 the conditions
A B K
i
P P Ai Bi K i 0, i 1, 2,...... L
and
Gij P PGij 0,
Where,
Gij A B K
i jL
P P Aj B jKi , i j L
are satisfied, then the closed-loop system modeled by
L (i )
L (i )
L ( j)
X (t ) A i ( X (t )) X (t ) B i ( X (t )) K j ( X (t )) X (t )
i 1
i 1
j 1
is asymptotically stable.
Design of stable fuzzy controller for
discrete time system:
X (k 1) i ( X (k )) Ai X (k ) B iU (k )
TS Model:-
i 1
U (k ) i ( X (k )) F ( i ) X (k )
TS Controller:-
j 1
Combining the above two equations we get,
L
X (k 1) i ( X (k )) j ( X ( k )) Ai B i F j X ( k )
i 1 j 1
i ( X (k ))i ( X (k )) A B F X (k ) 2 i ( X (k ))i ( X (k )) Gij X (k )
i
i 1
i 1 j i
i
i
j
j
j i
Where, G A B F A B F ,
ij
i j
such that i j 0
Theorem:2(a) The equilibrium of a fuzzy control
system is globally asymptotically stable if
a common P 0 s.t the following two conditions
are satisfied.
A B F P A B F P 0,
i
and
i 1, 2,....L
Gij PGij P 0, i j L, s.t i j 0 or i j 0
Where,
Ai Bi F j A j B j F i
Gij
2
The above two nonlinear inequalities can now be converted
to LMIs using the Schur complement to check the stability
of the overall fuzzy system.
More specifically, find Z and M i , i 1, 2,......L
satisfying the resulting LMIs
1
Z P 0
Ai Z B i M i
A Z B M
i
0 , for i 1, 2,....L
T
Z
Gij Z
0; for i j L
G Z
Z
ij
1
i
Z
P
The feedback gain F and P can be obtained as
P Z 1 and
F i M i Z 1.
Theorem-2 (b)
If for some symmetric positive definite Z the
following conditions
Ai Z B i M i
A Z B M
i
0 , for i 1, 2,....L
T
Z
Gij Z
and
0; for i j L
G Z
Z
ij
are satisfied, then the closed-loop system (see below) is stable
L
X (k 1) i ( X (k ))i ( X (k )) A B F X (k ) 2 i ( X (k ))i ( X (k )) Gij X (k )
i
i 1
i 1 j i
Fuzzy System Stability Via Interval
Matrix Method:
Discrete time system:
X (k 1) A G(k ) X (k ), X (k ) X 0
Stable matrix Unknown Time-Varying Perturbed Matrix
where,
G.(k ) Gm for all k
& inequality holds
element-wise.
Theorem: The time-varying discrete-time system described
above asymptotically stable if
A Gm 1
note : A max
limk X (k ) 0
.....
Contd.
Definition: An interval matrix A I ( k ) is an
matrix whose elements consist of interval
AI
bij cij for i, j 1, 2,........ n
b11 c11 . . b1n c1n
b
c
.
.
b
c
21
21
2n
2 n
.
. .
bn1 cn1 . .
bnn
cnn
Contd.
Note: The center matrix AC , and the maximum
difference matrix Am of AI are defined by
BC
CB
Ac
, Am
2
2
, where B bij , and C cij .
Note: AI can be expressed.
AI (k ) Ac Am
Ac Am Ac A(k ) with A(k ) Am
Lemma: The interval matrix AI (k ) is asymptotically
stable if the matrix Ac is stable and Ac Am 1 .
Stability of discrete fuzzy TS type
model using Interval matrix
approach.
Sufficient condition: Let us consider TS type
discrete model & rules are stated as
If x(k ) is Ai1 and ...... and x(k n 1) is Ai n , i 1, 2,.... L
Then x i (k 1) a i1 x(k ) a i 2 x(k 1) ...... a i n x( k n 1)
or
X (k 1) Ai X (k ) (transform to canonical form )
The output of effective fuzzy model after defuzzification can be obtained
in the following form
i
i
L
X (k 1)
i 1
A X (k )
L
i 1
The right hand side expression can be in interval matrix form A I .
The stability of the interval matrix can be
checked using the Lemma.
Stability Analysis of Mamdani Type Fuzzy
Control System
Nonlinear stability theory should be explored to
study the stability of Mamdani type fuzzy
control system. Describing Function method is
attractive because it is simple and gives better
insight of effects which the fuzzy element can
have on the stability of the closed loop system.
Different fuzzification techniques
Center of Gravity Method or Centroid method.
Weighted Average Method
Mean of Maximum method (MOM)
Center of Sums (COS)
Center of Largest Area Method (for nonconvex)
Fast ( or Last) Maximum Method
Mean-Max Method