Are you sure?
This action might not be possible to undo. Are you sure you want to continue?
for use with MATLAB and SIMULINK
Olaf Wolkenhauer
UMIST
Control Systems Centre
Manchester M60 1QD, England
http://www.csc.umist.ac.uk/
User’s Guide.
1
September 29, 1999
1
c O.Wolkenhauer, 1999. Neither this document nor any part may be reproduced in any form or by any
means without permission from the author.
Contents
1 Introduction: Fuzzy Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Fuzzy Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 Fuzzy Set Representations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Creating Fuzzy Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Conversion between Fuzzy Set Representations . . . . . . . . . . . . . . . . . . . . 8
2.4 Plotting Fuzzy Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.5 Modiﬁcations of Fuzzy Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3 Operations on Fuzzy Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.1 Operations for Fuzzy Sets in Discrete Representation . . . . . . . . . . . . . . . . . 13
Fuzzy Intersection – Triangular Norms . . . . . . . . . . . . . . . . . . . . . . . . . 13
Fuzzy Union – Triangular Conorms . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2 Logical Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Operators with Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3 Operations for Fuzzy Sets in LR Representation . . . . . . . . . . . . . . . . . . . 16
3.4 Operations for Fuzzy Sets in Lset Representation . . . . . . . . . . . . . . . . . . 16
3.5 Demonstration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4 Fuzzy RuleBased Systems, Fuzzy Inference Engines . . . . . . . . . . . . . . . . . . . . . 27
4.1 Fuzzy RuleBased Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2 Fuzzy Inference Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Composition Based Inference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Individualrule Based Inference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Particular Inference Engines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.3 Defuzziﬁers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.4 Demonstration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5 Fuzzy Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.1 Discrete PIcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.2 Fuzzy PIcontroller with Linear Defuzziﬁcation . . . . . . . . . . . . . . . . . . . . 37
Description of the Fuzzy PIcontroller . . . . . . . . . . . . . . . . . . . . . . . . . 37
Fuzziﬁcation Algorithm and Fuzzy Control Rules . . . . . . . . . . . . . . . . . . . 38
Defuzziﬁcation Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Rule Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Computer Simulation Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.3 Fuzzy PIcontroller with Nonlinear Defuzziﬁcation . . . . . . . . . . . . . . . . . . 42
Description of the Fuzzy PIcontroller . . . . . . . . . . . . . . . . . . . . . . . . . 42
Fuzziﬁcation Algorithm and Fuzzy Control Rules . . . . . . . . . . . . . . . . . . . 43
Defuzziﬁcation Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
A Fuzzy PIcontroller and a Nonlinear Nonfuzzy PIcontroller . . . . . . . . . . . . 44
Computer Simulation Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
5.4 Demonstration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6 Conclusions: Fuzzy Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
1
Acknowledgements
The core of ﬁles was written during a research project at the Medical Academy Dresden in Germany in
1994. The author is grateful for the support and encouragement given by Dr Peter Schaller, Institute
of Biomedical Engineering, Medizinische Akademie Karl Gustav Carus, Dresden in Germany. In 1999
Victor Colazzo updated the ﬁles to run under MATLAB version 5 and produced a ﬁrst version of the
user’s guide.
Fuzzy Systems Toolbox September 29, 1999 2
0 10 20 30 40 50 60 70 80 90 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
ip
0 10 20 30 40 50 60 70 80 90 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
ip
Fig. 1: Membership functions for linguistic terms ‘high’ and ‘low’.
1 Introduction: Fuzzy Control
Fuzzy systems are called knowledgebased or rulebased systems, since they consist of a set of fuzzy if 
then rules in which the universal set and fuzzy sets are involved in single statements. For example :
IF the level of a tank is high, THEN inﬂow should be low.
where the terms ‘level’ and ‘inﬂow’ represent are fuzzy variables represented by fuzzy sets (‘high’ and
‘low’ ) as shwon in ﬁgure 1.
The starting point of constructing a fuzzy system is to obtain a collection of fuzzy if  then rules
from experts. The next step is to combine these rules into a single rulebased system. There are three
types of fuzzy controllers frequently used in the literature: (i) “pure fuzzy systems”, (ii) “TakagiSugeno
fuzzy systems”, and (iii) fuzzy systems with fuzziﬁer and defuzziﬁer.
The “pure fuzzy system” is a collection of fuzzy if  then rules which represent the fuzzy rule
base. The main problem with this kind of fuzzy system is that its inputs and outputs are fuzzy sets,
whereas in engineering systems the inputs and outputs are realvalued variables. Takagi and Sugeno (12)
proposed another fuzzy system whose inputs and outputs are realvalued variables. In other words, the
TakagiSugeno system uses rules in the following form :
IF level x is high, THEN y = f(x).
where f(x) is a (usually) linear function.
Optionally, a fuzziﬁer is added to a pure fuzzy system input to transform a realvalued variable into
a fuzzy set. In the other hand, a defuzziﬁer is added to a pure fuzzy system output to transform a fuzzy
set into a realvalued variable.
A fuzzy proportional integral controller with two inputs and one output will be deﬁned in terms of
piecewise linear membership functions for fuzziﬁcation, control rules and a linear defuzziﬁcation algo
rithm. It will show that a fuzzy PIcontroller is not equivalent to a linear nonfuzzy PIcontroller if the
rules are evaluated using the Zadehlogic alone, and a fuzzy PIcontroller could be precisely equivalent
to a linear nonfuzzy PIcontroller if mixed fuzzy logic is used to evaluate the control rules.
Sources of nonlinearity in a fuzzy controller include the algorithm used for fuzziﬁcation, type of fuzzy
logic used for evaluating the fuzzy control rules, and the defuzziﬁcation algorithm used for the controller
output (14). Using a nonlinear defuzziﬁcation algorithm, demonstration ﬁles in the toolbox can be used
to show that a fuzzy PIcontroller is equivalent to a nonlinear nonfuzzy PIcontroller with proportional
and integral gains changing with the error and rate of change of error about a setpoint. Apart from this,
the performance of a simple fuzzy PIcontroller with linear and nonlinear defuzziﬁcation algorithms will
be analysed following the basic ideas suggested by Siler et al. (1988) (10) and Ying et al. (1990) (14).
Fuzzy Systems Toolbox September 29, 1999 3
The Fuzzy Systems Toolbox (FSTB) (13) for use with MATLAB
TM
and SIMULINK
TM
allows the
representation and visualisation of fuzzy sets and fuzzy systems in various formats. There are data
structures to work with the most common fuzzy set representations: LRrepresentation (a large class of
functions including exponential, trapezoidal, triangular shapes), discrete, vector, matrix, and αcut or L
set representations. Operations on fuzzy sets like fuzzy intersection and fuzzy union are also available in
this toolbox. Some of these operations are: algebraic product, minoperator, Einstein product, algebraic
sum, maxoperator, etc.
This User’s Guide provides a brief introduction of key concepts as they are implemented as part of
the FSTB. The User’s Guide is organised as follows:
We ﬁrst introduce deﬁnitions of fuzzy sets, the intuitive meaning of membership functions, diﬀerent
kind of fuzzy set representations and functions operating on fuzzy sets (modiﬁcation of fuzzy sets and
conversion between fuzzy set representations). Axiomatic deﬁnitions of snorm and tnorm are given.
Next we introduce the concept of fuzzy propositions, fuzzy if  then rules, diﬀerent interpretations of
fuzzy if  then rules, including DienesRescher, Lukasiewicz, Zadeh, G¨ odel and Mamdani implications,
the computational procedures for the composition based and individualrule based inferences, and the
detailed formulas of product and minimum inference engines.
The following section discusses fuzzy PIcontrollers with mixed fuzzy logic and fuzzy PIcontrollers
with linear and nonlinear defuzziﬁcation algorithms, following the basic ideas suggested by Siler et al.
(1988) (10) and Ying et al. (1990) (14).
Fuzzy Systems Toolbox September 29, 1999 4
2 Fuzzy Sets
Let U be the universal set, or the universe of discourse, which contains all the possible elements of a
particular application. Let A be a set in the universe of discourse U, where set A is represented as
A = {x ∈ U  x meets some conditions} (1)
There is another way to deﬁne a set A – the membership method, which introduces a zero  one
membership function for set A denoted by µ
A
(x), such that
µ
A
(x) =
_
1 if x ∈ A
0 if x ∈ A
(2)
The set A is mathematically equivalent to its membership function µ
A
(x) in the sense that knowing
µ
A
(x) is the same as knowing set A. The membership function µ
A
(x) can only take two values — zero and
one. That is to say, the set A must have a welldeﬁned property. If a set does not have clear boundaries,
it cannot be characterised by a membership function which takes two values.
For example, the word tall can have diﬀerent meanings depending on the context in which it is used,
a person may have some diﬃculty to classify boys to be tall or not tall. There are some bodyheights
which will always be classiﬁed as tall (e.g. 1.50 m) or not tall (e.g. 0.70 m), but for others (e.g. 1.10 m)
a deﬁnite classiﬁcation is hard to ﬁnd. It requires us to ﬁx a value of height in the way that a child has
to be called tall when child’s height exceeds this value. But the point of discontinuity, which appears in
the characteristic function, does not coincide with the conception that there is a smooth transition from
the height of a child who has to be called tall to that of a child who has to be called not tall.
One method to model gradual transitions is to use other degrees of membership in addition to 0 (does
not belong to it) and 1 (belongs to it). A mathematically simple way to introduce a gradual membership
consists in taking the degrees of membership from the compact interval [0, 1]. So, the concept of fuzzy
set is introduced to overcome this limitation of classical set theory.
A fuzzy set in a universe of discourse U is characterised by a membership function µ
A
(x) that takes
values in the interval [0, 1] (12).
µ
A
(x) : X → [0, 1]. (3)
In the following, several simple forms of representing fuzzy sets are given according to (5). In appli
cations an interpretation of tall as a monotonic nondecreasing function like
µ
a,b
(x) =
_
_
_
0, if x ≤ a
x−a
b−a
, if a ≤ x ≤ b
1, if x ≥ b,
(4)
where a < b, is employed. Other interpretations are piecewise linear functions, whose parameters are the
coordinates of the deﬁning points. Exponential functions like
µ
a,b
(x) =
_
1 −e
−a(x−b)
, if x ≥ b
0, if x < b,
(5)
where a > 0 and b ∈ U. To interpret linguistic expressions like ‘about a’, we most simply adopt symmet
rical triangular functions like
µ
a,b
(x) =
_
1− 
a−x
b
, if a −b ≤ x ≤ a +b
0, if x < a −b or x > a +b,
(6)
where b > 0 and a ∈ U, as well as bellshape Gaussian curves like
µ
a,b
(x) = e
−b(x−a)
2
(7)
Fuzzy Systems Toolbox September 29, 1999 5
where b > 0 and a ∈ U. The expression ‘approximately between b and c’ is most simply characterized by
the trapezoidal function
µ
a,b,c,d
(x) =
_
¸
¸
_
¸
¸
_
x−a
b−a
, if a ≤ x < b
1, if b ≤ x ≤ c
x−d
c−d
, if c < x ≤ d
0, if x < a or x > d,
(8)
where a < b < c < d and a, b, c, d ∈ U. Note that the real number a can be described by
µ
a
(x) = Π
{a}
(x) =
_
1, if x = a
0, if x = a,
(9)
and intervals [a, b] by
µ
a,b
(x) = Π
[a,b]
(x) =
_
1, if a ≤ x ≤ b
0, if x < a or x > b.
(10)
2.1 Fuzzy Set Representations
Fuzzy sets are the basic elements in fuzzy set theory. The toolbox provides ﬁve representations; discrete
representation, ‘vector representation’, ‘matrix representation’, ‘LR representation’, and ‘Lset represen
tation’.
Discrete representation: A fuzzy set requires two vectors for a representation; one vector con
taining the membership values of the fuzzy set and one vector containing the universe of discourse. For
fuzzy control, where we require libraries of fuzzy sets to represent a linguistic variable, we build a matrix
with one fuzzy set in each row. The universe of discourse must be identical for all fuzzy sets and stored
in an extra vector.
Vector representation: This data structure is especially used for fuzzy control and represents
piecewise linear, continuous triangular fuzzy sets. The fuzzy sets are fully overlapping; that is, the
membership values related to any given value of the universe of discourse, sum up to one. The most right
(left) fuzzy set is open; in other words, each given variable greater (smaller) than the most right (left)
centre of the fuzzy set is set to one. Knowing theses properties of membership functions, we only need
to specify the positions of the centres of the fuzzy sets. The term centre of the fuzzy set was introduced
above and it is deﬁned as follows :
If the mean value of all points at which the membership function of a fuzzy set achieves its maximum
value is ﬁnite, then deﬁne this mean value as the centre of the fuzzy set. If the mean value equals positive
(negative) inﬁnite, then the centre is deﬁned as the smallest (largest) among all points that achieve the
maximum membership value (12).
Example 2.1 Vector representation. See ﬁgure 2.
C = [1, 0.5, 0, 0.5, 1];
Matrix representation: It is also used in fuzzy control. It represents piecewise linear, continuous
trapezoidal fuzzy sets. A general trapezoid can be described by four characteristic points. Assuming
normal fuzzy sets (the membership values fall into the interval [0,1] and at least one point of each fuzzy
set has the membership value equal to one), the abscissa values are only needed to describe the trapezoidal
fuzzy set. A library of fuzzy sets is deﬁne as follows:
Example 2.2 Matrix representation. See ﬁgure 2.
D = [inf 0 40 60; % P1
0 20 60 100; % P2
0 40 60 100; % P3
40 60 80 inf]; % P4
Fuzzy Systems Toolbox September 29, 1999 6
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
ip
0 10 20 30 40 50 60 70 80 90 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
ip
Fig. 2: Vector representation (left) and matrix representation (right).
0 10 20 30 40 50 60 70 80 90 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
ip
Fig. 3: LR representation.
where each column describes one trapezoidal fuzzy set. The ﬁrst row (P1) describes the extreme left
point of every trapezoid. The fourth row (P4) describes the extreme right point. The values inf and inf
speciﬁed in P1 and in P4, respectively, deﬁne open trapezoids. If P2 = P3 the fuzzy set is triangular.
LR representation: It requires a vector described as follows. par=[xmin,xmax,m1,m2, alpha,beta,ymin,ymax]
where xmin is the minimum value of the universe of discourse or universal set, xmax is the maximum value
of the universe of discourse. The membership function reaches its maximum value between m1 and m2.
alpha is the distance between m1 and the left universeofdiscourse point when the membership function
reaches its minimum value. beta is the distance between m2 and the right universeofdiscourse point
when the membership function reaches its minimum value. ymin and ymax are the minimumvalue and
the maximumvalue of the membership function, respectively.
Example 2.3 LR representation. See ﬁgure 3.
[f,x] = modlrset(’tr’,’’,[0,100,40,60,10,10,0,1],200);
Lset representation: This representation is used to store fuzzy sets in αcuts representation. The
ﬁrst column of a matrix stores the αlevels for which the bounds of the levels sets are stored in further
columns. One fuzzy set requires a l ×3 matrix, where l is the number of levels greater than zero.
Example 2.4 Lset representation. See ﬁgure 9.
Lset=[1.00 3.00 3.00
0.75 2.50 3.50
0.50 2.00 4.00
0.25 1.50 4.50];
Fuzzy Systems Toolbox September 29, 1999 7
−100 −80 −60 −40 −20 0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
universe of discourse
m
e
m
b
e
r
s
h
ip
overlap = 4%
Fig. 4: modsuset().
−80 −60 −40 −20 0 20 40 60 80
0
0.2
0.4
0.6
0.8
1
universe of discourse
m
e
m
b
e
r
s
h
ip
Continue set
−80 −60 −40 −20 0 20 40 60 80
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
ip
Discrete set
Fig. 5: con2dis().
2.2 Creating Fuzzy Set
modsuset(): Modelling of symmetrical and unimodal trapezoidal fuzzy sets with the mouse.
Given two characteristic points P1 and P2, the library will be created automatically
for a given number of sets. The points P1 and P2 may be acquired with the mouse
or passed as parameters. The resulting set is given in ‘matrix representation’.
Example 2.5 This command returns seven trapezoidal fuzzy sets where the two characteristic points
P1 and P2 are −20 and −10, respectively. The most left and right trapezoid is open. The universe of
discourse falls within [−100, 100]. See ﬁgure 4.
modsuset(’y’,100,7,20,10);
modtrset(): Creates an arbitrary number of trapezoidal fuzzy sets using the mouse to specify
the characteristic points. The resulting set is given in ‘matrix representation’.
2.3 Conversion between Fuzzy Set Representations
con2dis(): Converts trapezoidal fuzzy sets into discrete fuzzy sets. See ﬁgure 5.
modgauss(): Converts a gaussian fuzzy set given in ‘LR representation’ into a discrete fuzzy set.
Example 2.6 This command returns two vectors (discrete representation) describing a bellshape Gaus
sian. See ﬁgure 6.
[f,x] = modgauss(0,1,3,3,200);
Fuzzy Systems Toolbox September 29, 1999 8
−3 −2 −1 0 1 2 3
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
ip
Fig. 6: modgauss().
modlrset(): Converts a fuzzy set given in ‘LR representation’ into a discrete fuzzy set.
Example 2.7 This command returns two vectors (discrete representation) describing a trapezoidal fuzzy
set and a triangular fuzzy set. See ﬁgure 7.
xmin = 0;
xmax = 100;
m1 = 40;
m2 = 60;
alpha = 10;
beta = 10;
ymin = 0;
ymax = 1;
resx = 400;
[A,x] = modlrset(’tr’,’’,[xmin,xmax,m1,m2,alpha,beta,ymin,ymax],resx);
m1 = 70;
m2 = 70;
alpha = 10;
beta = 10;
plot_set(x,modlrset(’tr’,’’,[xmin,xmax,m1,m2,alpha,beta,ymin,ymax],resx));
This command returns two vectors (discrete representation) given the function 1/(1 +x
2
). See ﬁgure
7.
L = ’1/(1+x^2)’;
R = ’1/(1+x^2)’;
xmin = 0;
xmax = 50;
m1 = 30;
m2 = 35;
alpha = 5;
beta = 2;
ymin = 0;
ymax = 1;
resx = 400;
[A,x] = modlrset(L,R,[xmin,xmax,m1,m2,alpha,beta,ymin,ymax],resx);
2.4 Plotting Fuzzy Sets
plot set(): Plots fuzzy sets given in ‘vector representation’, ‘matrix representation’, and ‘LR
representation’.
Fuzzy Systems Toolbox September 29, 1999 9
0 10 20 30 40 50 60 70 80 90 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
ip
0 5 10 15 20 25 30 35 40 45 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
ip
Fig. 7: modlrset(). Trapezoidal and triangular fuzzy sets (left), and L = R = 1/(1 +x
2
) (right).
35 40 45 50 55 60 65
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
ip
Fig. 8: plot set(). ‘LR representation’.
Example 2.8 This command plots fuzzy sets in ‘vector representation’. See ﬁgure 2.
plot_set([1,0.5,0,0.5,1]);
This command plots fuzzy sets in ‘matrix representation’. See ﬁgure 2.
D = [inf 0 40 60; % P1
0 20 60 100; % P2
0 40 60 100; % P3
40 60 80 inf]; % P4
plot_set(D);
This command plots a fuzzy set in ‘LR representation’. See ﬁgure 8.
plot_set([40;60;5;5],’tr’);
plot Lset(): Contour plot of fuzzy sets given in ‘Lset representation’.
Example 2.9 This command plots a fuzzy set in ‘Lset representation’. See ﬁgure 9.
Lset=[1.00 3.00 3.00
0.75 2.50 3.50
0.50 2.00 4.00
0.25 1.50 4.50];
plot_Lset(Lset);
grid on;
Fuzzy Systems Toolbox September 29, 1999 10
1.5 2 2.5 3 3.5 4 4.5
0
0.25
0.5
0.75
1
Universe of discourse
L
s
e
t
Fig. 9: plot Lset(). Lset representation.
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Normalisation
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Concentration
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Dilation
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Contrast−intensifying
Fig. 10: modi set().
2.5 Modiﬁcations of Fuzzy Sets
modi set(): Modiﬁcation of a fuzzy set or a fuzzy set library, and the operations are normaliza
tion, concentration, dilation, and contrast intensifying. See ﬁgure 10.
Trap2L(): Converts a trapezoidal fuzzy set given in ‘matrix representation’ into a fuzzy set in
‘Lset representation’. See ﬁgure 11.
Fuzzy Systems Toolbox September 29, 1999 11
10 15 20 25 30 35 40
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
ip
12.5 15 17.5 20 30 32.5 35 37.5
0
0.25
0.5
0.75
1
Universe of discourse
L
s
e
t
Fig. 11: Trap2L().
Fuzzy Systems Toolbox September 29, 1999 12
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
The sets A and B
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Bounded difference. t1bd(A,B)
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Einstein product. t15ep(A,B)
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
min−operator. t3mi(A,B)
Fig. 12: Fuzzy intersection.
3 Operations on Fuzzy Sets
3.1 Operations for Fuzzy Sets in Discrete Representation
The Fuzzy Systems Toolbox (FSTB) delivers basic operations for fuzzy sets given in ‘discrete representa
tion’. The functions can be classiﬁed in the following four sections:
Fuzzy Intersection – Triangular Norms
Let t : [0, 1] ×[0, 1] → [0, 1] be a mapping that transforms the membership functions of A and B into the
membership function of the intersection of A and B.
t[µ
A
(x), µ
B
(x)] = µ
A∩B
(x) (11)
In order for the function t to be qualiﬁed as an intersection, it must satisﬁed the following four require
ments (12) :
1. t(0, 0) = 0, t(1, a) = t(a, 1) = a (boundary condition).
2. t(a, b) = t(b, a) (commutative condition).
3. If a ≤ a
and b ≤ b
, then t(a, b) ≤ t(a
, b
) (nondecreasing).
4. t(t(a, b), c) = t(a, t(b, c)) (associativity).
The tnorm functions available in the Fuzzy Systems Toolbox (FSTB) are enumerated as follows (13) :
twdp(): drastic product t
w
[µ
A
(x), µ
B
(x)] =
_
_
_
µ
A
(x) if µ
B
(x) = 1
µ
B
(x) if µ
A
(x) = 1
0, otherwise.
t1bd(): bounded diﬀerence t
1
[µ
A
(x), µ
B
(x)] = max(0, µ
A
(x) +µ
B
(x) −1)
t15ep(): Einstein product t
1.5
[µ
A
(x), µ
B
(x)]=
(µ
A
(x) ∗ µ
B
(x))/(2 −(µ
A
(x) +µ
B
(x) −µ
A
(x) ∗ µ
B
(x)))
t2ap(): algebraic product t
2
[µ
A
(x), µ
B
(x)] = µ
A
(x) ∗ µ
B
(x)
t25hp(): Hamacher product t
2.5
[µ
A
(x), µ
B
(x)]=
µ
A
(x) ∗ µ
B
(x)/(µ
A
(x) +µ
B
(x) −µ
A
(x) ∗ µ
B
(x))
t3mi(): minoperator t
3
[µ
A
(x), µ
B
(x)] = min(µ
A
(x), µ
B
(x))
Fuzzy Systems Toolbox September 29, 1999 13
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
The sets A and B
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Bounded sum. s1bs(A,B)
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Einstein sum. s15es(A,B)
0 20 40 60 80 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
max−operator. s3ma(A,B)
Fig. 13: Fuzzy union.
Fuzzy Union – Triangular Conorms
Let A and B be fuzzy sets. Let s: [0, 1] × [0, 1] → [0, 1] be a mapping that transforms the membership
functions of A and B into the membership function of the union of A and B.
s[µ
A
(x), µ
B
(x)] = µ
A∪B
(x) (12)
In order for the function s to be qualiﬁed as a union, it must satisﬁed the following four requirements
(12).
1. s(1, 1) = 1, s(0, a) = s(a, 0) = a (boundary condition).
2. s(a, b) = s(b, a) (commutativity).
3. If a ≤ a
and b ≤ b
, then s(a, b) ≤ s(a
, b
) (nondecreasing).
4. s(s(a, b), c) = s(a, s(b, c)) (associativity).
The snorm functions available in the Fuzzy Systems Toolbox (FSTB) are enumerated as follows (13) :
swds(): drastic sum s
w
[µ
A
(x), µ
B
(x)] =
_
_
_
µ
A
(x) if µ
B
(x) = 0
µ
B
(x) if µ
A
(x) = 0
1, otherwise.
s1bs(): bounded sum s
1
[µ
A
(x), µ
B
(x)] = min(1, µ
A
(x) +µ
B
(x))
s15es(): Einstein sum s
1.5
[µ
A
(x), µ
B
(x)] = (µ
A
(x) +µ
B
(x))/(1 +µ
A
(x) ∗ µ
B
(x))
s2as(): algebraic sum s
2
[µ
A
(x), µ
B
(x)] = µ
A
(x) +µ
B
(x) −µ
A
(x) ∗ µ
B
(x)
s25hs(): Hamacher sum s
2.5
[µ
A
(x), µ
B
(x)]=
(µ
A
(x) +µ
B
(x) −2 ∗ µ
A
(x) ∗ µ
B
(x))/(1 −µ
A
(x) ∗ µ
B
(x))
s3ma(): maxoperator s
3
[µ
A
(x), µ
B
(x)] = max(µ
A
(x), µ
B
(x))
sumop(): sumoperator s[µ
A
(x), µ
B
(x)] = µ
A
(x) +µ
B
(x)
3.2 Logical Operations
f = fuz fand(): Fuzzy operator. When the parameter gamma is set to one, the operator is identical
to the minimumoperator. When the parameter gamma is set to zero, the operator
is equal to the arithmetic mean. See ﬁgure 14.
f = fuz for(): Fuzzy operator. When the parameter gamma is set to one, the operator is identical
to the maximumoperator. When the parameter gamma is set to zero, the average
value is calculated. See ﬁgure 15.
f = fuz not(): Complement of a fuzzy set in ‘discrete representation’. See ﬁgure 16.
Fuzzy Systems Toolbox September 29, 1999 14
0 10 20 30 40 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
the sets cold, warm and hot
cold
warm
hot
0 10 20 30 40 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Min−operator (gamma = 1)
fuz_fand(1,fuz_fand(1,hot,warm),cold)
0 10 20 30 40 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
fuz_fand(0.5,fuz_fand(0.5,hot,warm),cold)
0 10 20 30 40 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Average (gamma = 0)
fuz_fand(0,fuz_fand(0,hot,warm),cold)
Fig. 14: fuz fand().
0 10 20 30 40 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
the sets cold, warm and hot
cold
warm
hot
0 10 20 30 40 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Max−operator (gamma = 1)
fuz_for(1,fuz_for(1,hot,warm),cold)
0 10 20 30 40 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
fuz_for(0.5,fuz_for(0.5,hot,warm),cold)
0 10 20 30 40 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Average (gamma = 0)
fuz_for(0,fuz_for(0,hot,warm),cold)
Fig. 15: fuz for().
Fuzzy Systems Toolbox September 29, 1999 15
0 10 20 30 40 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Fuzzy set
0 10 20 30 40 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
fuz_not(Fuzzy set)
Fig. 16: fuz not().
Operators with Parameters
f = gamma a(): Gamma operator. It is also called compensatoryand operator. This operator
depends on gamma working between the algebraic product and the algebraic sum.
See ﬁgure 17.
f = gamma b(): Gamma operator. It is a convex combination of the minoperator and the max
operator. See ﬁgure 18.
3.3 Operations for Fuzzy Sets in LR Representation
The toolbox provides basic algebraic operations for fuzzy sets given in ‘LR representation’. The functions
are given in the following list : f = fuz add(): Extended addition of two fuzzy sets in ‘LR representation’. See ﬁgure
f = fuz div(): Approximated division of two fuzzy sets in ‘LR representation’. See ﬁgure 20.
f = fuz exp(): Exponential function of a fuzzy set in ‘LR representation’. See ﬁgure 21.
f = fuz inv(): Inversion of a fuzzy set in ‘LR representation’.
f = fuz log(): Natural logarithm of a fuzzy set in ‘LR representation’. See ﬁgure 21.
f = fuz mul(): Multiplication of two fuzzy sets in ‘LR representation’. See ﬁgure 22.
f = fuz sign(): Determines the sign of a fuzzy set in ‘LR representation’.
f = fuz sire(): Sign reversal of a fuzzy set in ‘LR representation’. See ﬁgure 19.
f = fuz sub(): Subtraction of two fuzzy sets in ‘LR representation’. See ﬁgure 19.
3.4 Operations for Fuzzy Sets in Lset Representation
The toolbox delivers basic operations for fuzzy sets given in ‘Lset representation’. The functions are
given in the following list :
f = L abs(): Absolute value of the fuzzy quantity given in ‘Lset representation’. See ﬁgure 23.
f = L add(): Addition of two fuzzy quantities given in ‘Lset representation’. See ﬁgure 24.
f = L dist(): Fuzzy distance between two fuzzy quantities given in ‘Lset representation’. See
ﬁgure 25.
f = L match(): Matching degree of a crisp value in the universe of discourse with the fuzzy set given
in ‘Lset representation’.
f = L mean(): The mean value of a fuzzy number in ‘Lset representation’. See ﬁgure 26.
f = L neg(): Negation of a fuzzy quantity given in ‘Lset representation’. See ﬁgure 27.
f = L ng(Lset): The fuzzy set of numbers that are necessarily greater than Lset. See ﬁgure 28.
f = L nl(Lset): The fuzzy set of numbers that are necessarily less than Lset. See ﬁgure 29.
f = L prod(): Product of two fuzzy quatities given in ‘Lset representation’. See ﬁgure 30.
f = L sim(): Similarity between two fuzzy quatities given in ‘Lset representation’. See ﬁgure 31.
f = L sub(): Subtraction of two fuzzy quantities given in ‘Lset representation’. See ﬁgure 32.
Fuzzy Systems Toolbox September 29, 1999 16
0
0.5
1
0
0.5
1
0
0.5
1
gamma_a, gamma=0, algebraic product
0
0.5
1
0
0.5
1
0
0.5
1
gamma_a, gamma=0.3
0
0.5
1
0
0.5
1
0
0.5
1
gamma_a, gamma=0.6
0
0.5
1
0
0.5
1
0
0.5
1
gamma_a, gamma=1, algebraic sum.
Fig. 17: gamma a() and show op().
0
0.5
1
0
0.5
1
0
0.5
1
gamma_b, gamma=0, max−operator
0
0.5
1
0
0.5
1
0
0.5
1
gamma_b, gamma=0.3
0
0.5
1
0
0.5
1
0
0.5
1
gamma_b, gamma=0.6
0
0.5
1
0
0.5
1
0
0.5
1
gamma_b, gamma=1, min−operator
Fig. 18: gamma b() and show op().
Fuzzy Systems Toolbox September 29, 1999 17
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
x1 x2
x1, x2
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
x1 x2
x1 + x2
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
x1 x2
x1 − x2
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
x2
sign reversal x2
Fig. 19: fuz add(), fuz sub() and fuz sire().
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
x1 x2
x1 / x2
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
x1 −x2
x1 / (−x2)
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
−x1 −x2
(−x1) / (−x2)
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
−x1 x2
(−x1) / x2
Fig. 20: fuz div().
Fuzzy Systems Toolbox September 29, 1999 18
−10 0 10 20 30 40 50 60 70 80 90 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
x1
x1, log(x1)
−10 0 10 20 30 40 50 60 70 80 90 100
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
x1
fuz_exp(x1)
Fig. 21: fuz log() and fuz exp().
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
x1 x2
x1 * x2
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
x1 −x2
x1 * (−x2)
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
−x1 −x2
(−x1) * (−x2)
−50 0 50
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
−x1 x2
(−x1) * x2
Fig. 22: fuz mul().
Fuzzy Systems Toolbox September 29, 1999 19
−2 −1 0 1 1.75 2.5 3.25
0
0.25
0.5
0.75
1
Universe of discourse
Q
Families of alpha−cuts:
−2 −1 0 1 1.75 2.5 3.25
0
0.25
0.5
0.75
1
Universe of discourse
a
b
s
(
Q
)
Fig. 23: L abs().
0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.25 2.5 2.75 3 3.5 4 4.5
0
0.25
0.5
0.75
1
Universe of discourse
s
1
Families of alpha−cuts:
0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.25 2.5 2.75 3 3.5 4 4.5
0
0.25
0.5
0.75
1
Universe of discourse
s
2
0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.25 2.5 2.75 3 3.5 4 4.5
0
0.25
0.5
0.75
1
Universe of discourse
s
1
+
s
2
Fig. 24: L add().
Fuzzy Systems Toolbox September 29, 1999 20
0 2.5 3 3.5 4 4.5 5 5.5
0
0.25
0.5
0.75
1
Universe of discourse
s
1
Families of alpha−cuts:
0 2.5 3 3.5 4 4.5 5 5.5
0
0.25
0.5
0.75
1
Universe of discourse
s
2
0 2.5 3 3.5 4 4.5 5 5.5
0
0.25
0.5
0.75
1
Universe of discourse
d
i
s
t
(
s
1
,
s
2
)
Fig. 25: L dist().
0.25 0.5 0.75 1 1.25 1.5 1.75
0
0.25
0.5
0.75
1
Mean value = [0.625, 1.38]
L
s
e
t
Fig. 26: L mean().
Fuzzy Systems Toolbox September 29, 1999 21
−1.5 −1 −0.75 −0.5 −0.25 0 0.25 0.5 0.75 1 1.5
0
0.25
0.5
0.75
1
Universe of discourse
Q
Families of alpha−cuts:
−1.5 −1 −0.75 −0.5 −0.25 0 0.25 0.5 0.75 1 1.5
0
0.25
0.5
0.75
1
Universe of discourse
−
Q
Fig. 27: L neg().
0.25 0.5 0.75 1 1.25 1.5 1.75 2
0
0.25
0.5
0.75
1
Universe of discourse
L
s
e
t
0.25 0.5 0.75 1 1.25 1.5 1.75 2
0
0.25
0.5
0.75
1
Universe of discourse
L
_
n
g
(
L
s
e
t
)
Fig. 28: L ng().
Fuzzy Systems Toolbox September 29, 1999 22
0 0.25 0.5 0.75 1 1.25 1.5 1.75
0
0.25
0.5
0.75
1
Universe of discourse
L
s
e
t
0 0.25 0.5 0.75 1 1.25 1.5 1.75
0
0.25
0.5
0.75
1
Universe of discourse
L
_
n
l
(
L
s
e
t
)
Fig. 29: L nl().
0.49 0.64 0.7 0.8 0.81 0.9 1 1.1 1.2 1.21 1.3 1.44 1.69
0
0.25
0.5
0.75
1
Universe of discourse
s
1
Families of alpha−cuts:
0.49 0.64 0.7 0.8 0.81 0.9 1 1.1 1.2 1.21 1.3 1.44 1.69
0
0.25
0.5
0.75
1
Universe of discourse
s
2
0.49 0.64 0.7 0.8 0.81 0.9 1 1.1 1.2 1.21 1.3 1.44 1.69
0
0.25
0.5
0.75
1
Universe of discourse
s
1
*
s
2
Fig. 30: L prod().
Fuzzy Systems Toolbox September 29, 1999 23
3.25 3.5 3.75 4 4.25 4.5 4.75 5 5.25 5.5 5.75
0
0.25
0.5
0.75
1
Universe of discourse
s
1
Families of alpha−cuts:
3.25 3.5 3.75 4 4.25 4.5 4.75 5 5.25 5.5 5.75
0
0.25
0.5
0.75
1
Shape similarity measure = 0.825
s
2
Fig. 31: L sim().
−2 −1.5 −1 −0.5 0 0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.25
0
0.25
0.5
0.75
1
Universe of discourse
s
1
Families of alpha−cuts:
−2 −1.5 −1 −0.5 0 0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.25
0
0.25
0.5
0.75
1
Universe of discourse
s
2
−2 −1.5 −1 −0.5 0 0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.25
0
0.25
0.5
0.75
1
Universe of discourse
s
1
−
s
2
Fig. 32: L sub().
Fuzzy Systems Toolbox September 29, 1999 24
Fig. 33: gui con1.
3.5 Demonstration Files
The Fuzzy Systems Toolbox (FSTB) provides eleven demonstration ﬁles. They are script ﬁles and may
also serve as a kind of user’s guide. Execute the demonstration ﬁles from the MATLAB
TM
workspace.
The demonstration ﬁles which are related to the sections in the User’s Guide are :
fuz demo1: The commands employed by this demo are given below :
1. plot set(), modlrset() (LR representation).
2. plot set(), modlrset() (L = 1/(1 +x
2
) = R).
3. plot set(), modgauss().
4. plot set() (matrix representation).
5. s1bs(), s15es(), s3ma().
6. t1bd(), t15ep(), t3mi().
7. show op(), gamma a().
8. show op(), gamma b().
9. modi set().
10. fuz fand().
11. fuz for().
12. fuz not().
13. fuz add(), fuz sub(), fuz sire().
14. fuz mul().
15. fuz div().
16. fuz log(), fuz exp().
gui con1: GUI driven demonstration ﬁle for logical connectives. See ﬁgure 33.
gui con2: GUI driven demonstration ﬁle for logical connectives. See ﬁgure 34.
Fuzzy Systems Toolbox September 29, 1999 25
Fig. 34: gui con2.
Fuzzy Systems Toolbox September 29, 1999 26
Fuzzy system.
Fuzzy system.
x
x
2
1
y
y
2
1
Fuzzy system.
y
x
n
m
n inputs. 1 output.
n inputs. 1 output.
n inputs. 1 output.
Fig. 35: A multiinputmultioutput fuzzy system.
4 Fuzzy RuleBased Systems, Fuzzy Inference Engines
Consider the multiinputsingleoutput fuzzy system shown in ﬁgure (35), where
x = (x
1
,x
2
, ...,x
n
)
T
∈ U ⊂ R
n
and y ∈ V ⊂ R. A multioutput system can always be decomposed
into a collection of singleoutput systems.
4.1 Fuzzy RuleBased Systems
A fuzzy ifthen rule is a conditional statement expressed as
IF < fuzzy proposition >, THEN < fuzzy proposition > (13)
where fuzzy proposition could be a single statement or a composition of single statements. A single
statement is x is A, where A is a fuzzy set deﬁned in the physical domain of x. The composition of single
statements is x
1
is A
1
and x
2
is A
2
or x
3
is A
3
, where the connectives “and” and “or” represent fuzzy
intersection and fuzzy union, respectively.
Therefore, the composition of single statements should be understood as fuzzy relations. How to determine
the membership functions of these fuzzy relations is given as follows (12) :
• For connective “and” use fuzzy intersections. Speciﬁcally, let x and y be linguistic variables in the
physical domains U and V , and A and B be fuzzy sets in U and V , respectively. Then, the compound
fuzzy proposition
x is A and y is B (14)
is interpreted as the fuzzy relation A ∩ B in U x V with membership function
µ
A∩B
(x, y) = t[µ
A
(x), µ
B
(y)] (15)
where t : [0, 1] ×[0, 1] → [0, 1] is any tnorm.
• For connective “or” use fuzzy unions. Speciﬁcally, the compound fuzzy proposition
x is A or y is B (16)
Fuzzy Systems Toolbox September 29, 1999 27
is interpreted as the fuzzy relation A ∪ B in U x V with membership function
µ
A∪B
(x, y) = s[µ
A
(x), µ
B
(y)] (17)
where s: [0, 1] ×[0, 1] → [0, 1] is any snorm.
The fuzzy rulebased system is interpreted as a fuzzy relation in the inputoutput product space U x V ,
and comprises the following fuzzy ifthen rules :
Ru
(l)
: IF x
1
is A
l
1
and ... and x
n
is A
l
n
, THEN y is B
l
(18)
where A
l
i
and B
l
are fuzzy sets in U
i
∈ R and V ∈ R, respectively, and x = (x
1
,x
2
, . . . , x
n
)
T
∈ U
and y ∈ V are the input and output variables of the fuzzy system, respectively. Let M be the number
of rules in the fuzzy rulebased system; that is, l = 1, 2, . . . , M in (18). Rules in the form of (18) are
called canonical fuzzy ifthen rules because they include many other types of fuzzy rules and fuzzy
propositions as special cases, as shown in the following lemma (12).
Lemma 4.1 : The canonical fuzzy ifthen rules in the form of (18) include the following as special
cases:
• Partial Rules :
IF x
1
is A
l
1
and ... and x
m
is A
l
m
, THEN y is B
l
(19)
where m < n.
• Or rules :
IF x
1
is A
l
1
and ... and x
m
is A
l
m
or x
m+1
is A
l
m+1
and ... and x
n
is A
l
n
,
THEN y is B
l
(20)
• Single fuzzy statement :
y is B
l
(21)
• Nonfuzzy rules.
The partial rule (19) is equivalent to
IF x
1
is A
l
1
and ... and x
m
is A
l
m
or x
m+1
is I and ... and x
n
is I,
THEN y is B
l
(22)
where I is a fuzzy set in R with µ
I
(x) ≡ 1 for all x ∈ R. Based on intuitive meaning of the logic operator
or, the Or rule (20) is equivalent to the following two rules :
IF x
1
is A
l
1
and ... and x
m
is A
l
m
, THEN y is B
l
(23)
IF x
m+1
is A
l
m+1
and ... and x
n
is A
l
n
, THEN y is B
l
(24)
The fuzzy statement (21) is equivalent to
Ru
(l)
: IF x
1
is I and ... and x
n
is I, THEN y is B
l
(25)
Finally, if the membership functions of A
l
i
and B
l
can only take values 1 or 0, then the rules (18) become
nonfuzzy rules.
4.2 Fuzzy Inference Engine
In a fuzzy inference engine, fuzzy logic principles are used to combine the fuzzy ifthen rules in the fuzzy
rulebased system into a mapping from a fuzzy set A
in U to a fuzzy set B
in V . Now, the question
is how to infer with a set of rules. There are two ways to infer with a set of rules: composition based
inference and individualrule based inference
Fuzzy Systems Toolbox September 29, 1999 28
Composition Based Inference
In composition based inference, all rules in the fuzzy rulebased system are combined into a single fuzzy
relation in U ×V , which is viewed as a single fuzzy ifthen rule.
There are two opposite arguments : The ﬁrst one views the rules as independent conditional statements,
then a reasonable operator to combine the rules is union. The second one views the rules as strongly
coupled conditional statements such that the conditions of all the rules must be satisﬁed, then a reasonable
operator to combine the rules is intersection.
Let Ru
l
be a fuzzy relation in U × V , which represents the fuzzy ifthen rule (18). In other words,
Ru
l
= A
l
1
×· · · ×A
l
n
→ B
l
where A
l
1
×· · · ×A
l
n
is a fuzzy relation in U = U
1
×· · · ×U
n
deﬁned by
µ
A
l
1
×···×A
l
n
(x
1
, . . . , x
n
) = µ
A
l
1
(x
1
) ∗ · · · ∗ µ
A
l
n
(x
n
) (26)
where * represents any tnorm operator. The implication → in Ru
l
represents any of the following
implications (12) :
• DienesRescher Implication :
µ
Ru
(l)
= µ
Q
D
(x, y) = max
_
1 −µ
A
l
1
×···×A
l
n
(x
1
, . . . , x
n
), µ
B
l
(y)
¸
(27)
• Lukasiewicz Implication :
µ
Ru
(l)
= µ
Q
L
(x, y) = min
_
1, 1 −µ
A
l
1
×···×A
l
n
(x
1
, . . . , x
n
) +µ
B
l
(y)
¸
(28)
• Zadeh Implication :
µ
Ru
(l)
= µ
Q
Z
(x, y) = max
_
min
_
µ
A
l
1
×···×A
l
n
(x
1
, . . . , x
n
), µ
B
l
(y)
_
, 1 −µ
A
l
1
×···×A
l
n
(x
1
, . . . , x
n
)
¸
(29)
• G¨ odel Implication :
µ
Ru
(l)
= µ
Q
G
(x, y) =
_
1 if µ
A
l
1
×···×A
l
n
(x
1
, . . . , x
n
) ≤ µ
B
l
(y)
µ
B
l
(y) otherwise
(30)
• Mamdani Implications :
µ
Ru
(l)
= µ
Q
MM
(x, y) = min
_
µ
A
l
1
×···×A
l
n
(x
1
, . . . , x
n
), µ
B
l
(y)
¸
(31)
or
µ
Ru
(l)
= µ
Q
MP
(x, y) = µ
A
l
1
×···×A
l
n
(x
1
, . . . , x
n
)µ
B
l
(y) (32)
The M rules in the form (18) are interpreted as a single fuzzy relation Q
M
in U ×V deﬁned by
Q
M
=
M
_
l=1
Ru
(l)
(33)
This combination is called the Mamdani combination. If the symbol + is used to represent the snorm,
then (33) can be rewritten as
µ
Q
M
(x, y) = µ
(1)
Ru
(x, y) +· · · +µ
(M)
Ru
(x, y) (34)
For the second view of a set of rules, the M fuzzy ifthen rules of (18) are interpreted as a fuzzy relation
Q
G
in U ×V , which is deﬁned as
Q
M
=
M
l=1
Ru
(l)
(35)
or
µ
Q
G
(x, y) = µ
(1)
Ru
(x, y) ∗ · · · ∗ µ
(M)
Ru
(x, y) (36)
Fuzzy Systems Toolbox September 29, 1999 29
where * denotes tnorm. This combination is called the G¨ odel combination.
Let A
be a fuzzy singleton set in U as shown
µ
A
(x) =
_
1 if x = x
∗
∀x
∗
∈ U ⊂ R
n
0 otherwise
(37)
and be the input to the fuzzy inference engine. If Q
M
is consider as a single fuzzy ifthen rule, the
output of the fuzzy inference engine is the projection of A
∩Q
M
on V .
µ
B
(y) = sup
x∈U
t [µ
A
(x), µ
Q
M
(x, y)] (38)
The G¨odel combination gives the following expression :
µ
B
(y) = sup
x∈U
t [µ
A
(x), µ
Q
G
(x, y)] (39)
The computational procedure of the composition based inference is given as follows :
Step 1: Determine the membership functions µ
A
l
1
×···×A
l
n
(x
1
, . . . , x
n
) for l = 1, 2, . . . , M according to
(26).
Step 2: Determine µ
Ru
(l)
(x, y) = µ
A
l
1
×···×A
l
n
→B
l (x
1
, . . . , x
n
) for l = 1, 2, . . . , M according to any given
implication.
Step 3: Determine µ
Q
M
(x, y) or µ
Q
G
(x, y) according to (34) or (36).
Step 4: Given input fuzzy set A
, the fuzzy inference engine gives output B
according to (38) or (39).
Individualrule Based Inference
In individualrule based inference, each rule in the fuzzy rulebased system determines an output fuzzy
set and the output of the fuzzy inference engine is the combination of the M individual fuzzy sets. The
combination of the M fuzzy sets can be taken either by union or by intersection.
The computational procedure of the individualrule based inference is given as follows :
Step 1: Determine the membership functions µ
A
l
1
×···×A
l
n
(x
1
, . . . , x
n
) for l = 1, 2, . . . , M according to
(26)
Step 2: Determine µ
Ru
(l)
(x, y) = µ
A
l
1
×···×A
l
n
→B
l (x
1
, . . . , x
n
) for l = 1, 2, . . . , M according to any given
implication.
Step 3: Given input fuzzy set A
∈U, compute the output fuzzy set B
∈V for each individual rule Ru
(l)
according to
µ
B
l
(y) = sup
x∈U
t
_
µ
A
(x), µ
Ru
(l)
(x, y)
_
(40)
for l = 1, 2, . . . , M.
Step 4: The output of the fuzzy inference engine is the combination of the M fuzzy set {B
1
, . . . , B
M
}
either by union
µ
B
(y) = µ
B
1
(y) +· · · +µ
B
M
(y) (41)
or by intersection
µ
B
(y) = µ
B
1
(y) ∗ · · · ∗ µ
B
M
(y) (42)
where + and * denote snorm and tnorm operators, respectively.
Fuzzy Systems Toolbox September 29, 1999 30
Particular Inference Engines
From above we can identify various inference engines depending on the structure : Composition based
inference or individualrule based inference, and within the composition based inference, Mamdani com
bination or G¨ odel combination. With regard to the implication we can chose from DienesRescher impli
cation (27), Lukasiewicz implication (28), Zadeh implication (29), G¨ odel implication (30), or Mamdani
implications (31)(32). Finally, tnorm and snorm operators in the various formulas. The following three
criteria should be considered when a selection has to be made (12).
Intuitive appeal: The choice should make sense from an intuitive point of view. For example, if a set
of rules are given by a human expert who believes that these rules are independent of each other,
then they should be combined by union.
Computational eﬃciency: The choice should result in a formula relating B
with A
, which is simple
to compute.
Special properties: Some choice may result in an inference engine that has special properties. If these
properties are desirable, then this choice should be made.
The product inference engine and the minimum inference engine are the most commonly used fuzzy
inference engines in fuzzy systems and fuzzy control. The main advantage of them is their computational
simplicity. Also, they are intuitively appealing for many practical problems, especially for fuzzy control.
The product inference engine and the minimum inference engine are given as follows :
Product Inference Engine: Product inference engine uses individualrule based inference with union
combination (41), Mamdani’s product implication (32), and algebraic product for all the tnorm
operator and max for all the snorm operators. The product inference engine is
µ
B
(y) =
M
max
l=1
_
sup
x∈U
_
µ
A
(x)
n
i=1
µ
A
l
i
(x
i
)µ
B
l (y)
__
(43)
Minimum Inference Engine: Minimum inference engine uses individualrule based inference with
union combination (41), Mamdani’s minimum implication (31), and min for all the tnorm op
erators and max for all the snorm operators. The minimum inference engine is
µ
B
(y) =
M
max
l=1
_
sup
x∈U
min
_
µ
A
(x), µ
A
l
1
(x
1
), ..., µ
A
l
n
(x
n
), µ
B
l (y)
_
_
(44)
4.3 Defuzziﬁers
The task of the defuzziﬁer is to specify a crisp point y
∗
∈ V ⊂ R that represents the fuzzy set B
∈ V .
The following three criteria should be considered to choose a defuzziﬁcation scheme (12).
Plausibility: The point y
∗
should represent B
from an intuitive point of view. For example, it may lie
approximately in the middle of the support of B
or has a high degree of membership in B
.
Computational simplicity: This criterion is particularly important for fuzzy control because fuzzy
controllers operate in realtime.
Continuity: A small change in B
should not result in a large change in y
∗
.
There are three types of defuzziﬁers: centre of gravity defuzziﬁer, centre average defuzziﬁer and maximum
defuzziﬁer. The centre average defuzziﬁer is the most commonly used defuzziﬁer in fuzzy systems and
fuzzy control. It is computational simple and intuitively plausible. Its deﬁnition is (12) :
Deﬁnition 1 . Let ¯ y
l
be the centre of the l
th fuzzy set B
l
and w
l
be its height, the centre average
defuzziﬁer determines y
∗
as
y
∗
=
M
l=1
¯ y
l
w
l
M
l=1
w
l
(45)
Fuzzy Systems Toolbox September 29, 1999 31
Suppose that the fuzzy set B
l
in (18) is normal with centre ¯ y
l
. The fuzzy systems with fuzzy rulebased
system (18), product inference engine (43), singleton fuzziﬁer (37) and centre average defuzziﬁer (45),
are of the following form :
f(x) =
M
l=1
¯ y
l
_
n
i=1
µ
A
l
i
(x
i
)
_
M
l=1
_
n
i=1
µ
A
l
i
(x
i
)
_ (46)
where x ∈ U ⊂ R
n
is the input to the fuzzy system, and f(x) ∈ V ⊂ R is the output of the fuzzy system.
Another class of commonly used fuzzy systems is obtained by replacing the product inference engine in
(46) by the minimum inference engine. The fuzzy systems with fuzzy rulebased system (18), minimum
inference engine (44), singleton fuzziﬁer (37) and centre average defuzziﬁer (45), are of the following
form :
f(x) =
M
l=1
¯ y
l
_
min
n
i=1
µ
A
l
i
(x
i
)
_
M
l=1
_
min
n
i=1
µ
A
l
i
(x
i
)
_ (47)
where x ∈ U ⊂ R
n
is the input to the fuzzy system, and f(x) ∈ V ⊂ R is the output of the fuzzy system.
Example 4.1 . Let y(x) be a fuzzy system with two inputs x=(x
1
, x
2
). The fuzzy rulebased system is:
IF x
1
is A
n1
and x
2
is A
n2
THEN y is B
1
IF x
1
is A
z1
and x
2
is A
n2
THEN y is B
2
IF x
1
is A
p1
and x
2
is A
n2
THEN y is B
3
IF x
1
is A
n1
and x
2
is A
z2
THEN y is B
4
IF x
1
is A
z1
and x
2
is A
z2
THEN y is B
5
IF x
1
is A
p1
and x
2
is A
z2
THEN y is B
6
IF x
1
is A
n1
and x
2
is A
p2
THEN y is B
7
IF x
1
is A
z1
and x
2
is A
p2
THEN y is B
8
IF x
1
is A
p1
and x
2
is A
p2
THEN y is B
9
(48)
where A
n1
, A
z1
and A
p1
are triangular members of a fuzzy set which is fully overlapping. The centre of
the members A
n1
, A
z1
and A
p1
are set to 1, 0 and 1, respectively. In the same way, A
n2
, A
z2
and A
p2
are triangular members of a fully overlapping fuzzy set. The centre of the members A
n2
, A
z2
and A
p2
are
set to 1, 0, and 1, respectively. The centre of the fuzzy sets B
1
, B
2
, B
3
, B
4
, B
5
, B
6
, B
7
, B
8
and B
9
are
set to 1, 0.75, 0.5, 0.25, 0, 0.25, 0.5, 0.75 and 1, respectively. In other words; ¯ y
1
= 1, ¯ y
2
= 0.75,
¯ y
3
= 0.5, ¯ y
4
= 0.25, ¯ y
5
= 0, ¯ y
6
= 0.25, ¯ y
7
= 0.5, ¯ y
8
= 0.75 and ¯ y
9
= 1. Now, the fuzzy system with
fuzzy rulebased system (48), product inference engine (43), singleton fuzziﬁer (37) and centre average
defuzziﬁer (45), is of the following form :
y(x
1
, x
2
) =
9
l=1
¯ y
l
_
2
i=1
µ
A
l
i
(x
i
)
_
9
l=1
_
2
i=1
µ
A
l
i
(x
i
)
_ (49)
or
y(x
1
, x
2
) =
¯ y
1
(µ
A
n1
(x
1
)µ
A
n2
(x
2
)) + ¯ y
2
(µ
A
z1
(x
1
)µ
A
n2
(x
2
)) +... + ¯ y
9
(µ
A
p1
(x
1
)µ
A
p2
(x
2
))
µ
A
n1
(x
1
)µ
A
n2
(x
2
) +µ
A
z1
(x
1
)µ
A
n2
(x
2
) +... +µ
A
p1
(x
1
)µ
A
p2
(x
2
)
(50)
Figure (36) shows a plot of the fuzzy system y(x
1
, x
2
). Figure (37) shows the same system, but the
members of the input fuzzy sets have been changed to gaussian shape.
Example 4.2 . Now, consider a fuzzy system with fuzzy rulebased system (48), minimum inference
engine (44), singleton fuzziﬁer (37) and centre average defuzziﬁer (45). It has the following form :
y(x
1
, x
2
) =
9
l=1
¯ y
l
_
min
2
i=1
µ
A
l
i
(x
i
)
_
9
l=1
_
min
2
i=1
µ
A
l
i
(x
i
)
_ (51)
Fuzzy Systems Toolbox September 29, 1999 32
−1 −0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Input fuzzy set
−1 −0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Output fuzzy set
−1
0
1
−1
0
1
−1
0
1
x
1
Product Inference Engine
x
2
Y
−1 −0.5 0 0.5 1
−1
−0.5
0
0.5
1
x
1
x
2
Product Inference Engine
Fig. 36: Product Inference Engine.
or
y(x
1
, x
2
) =
¯ y
1
min(µ
A
n1
(x
1
), µ
A
n2
(x
2
)) +... + ¯ y
9
min(µ
A
p1
(x
1
), µ
A
p2
(x
2
))
min(µ
A
n1
(x
1
), µ
A
n2
(x
2
)) +... +min(µ
A
p1
(x
1
), µ
A
p2
(x
2
))
(52)
Figures (38) and (39) show the plot of the fuzzy system y(x
1
, x
2
) with triangular and gaussian members
of input fuzzy sets, respectively.
4.4 Demonstration Files
The Fuzzy Systems Toolbox (FSTB) provides several demonstration ﬁles. They are script ﬁles and may
also serve as a kind of user’s guide. Execute the demonstration ﬁles from the MATLAB
TM
workspace.
The demonstration ﬁles which related to the previous section, are :
gui ar1: GUI driven demonstration ﬁle for approximate reasoning: Simple temperature con
trol. See ﬁgure 40.
inference engine demo: Executes the examples 4.1 and 4.2.
Fuzzy Systems Toolbox September 29, 1999 33
−1 −0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Input fuzzy set
−1 −0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Output fuzzy set
−1
0
1
−1
0
1
−1
0
1
x
1
Product Inference Engine
x
2
Y
−1 −0.5 0 0.5 1
−1
−0.5
0
0.5
1
x
1
x
2
Product Inference Engine
Fig. 37: Product Inference Engine.
−1 −0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Input fuzzy set
−1 −0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Output fuzzy set
−1
0
1
−1
0
1
−1
0
1
x
1
Minimum Inference Engine
x
2
Y
−1 −0.5 0 0.5 1
−1
−0.5
0
0.5
1
x
1
x
2
Minimum Inference Engine
Fig. 38: Minimum Inference Engine.
Fuzzy Systems Toolbox September 29, 1999 34
−1 −0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Input fuzzy set
−1 −0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Universe of discourse
M
e
m
b
e
r
s
h
i
p
Output fuzzy set
−1
0
1
−1
0
1
−1
0
1
x
1
Minimum Inference Engine
x
2
Y
−1 −0.5 0 0.5 1
−1
−0.5
0
0.5
1
x
1
x
2
Minimum Inference Engine
Fig. 39: Minimum Inference Engine.
Fig. 40: gui ar1.
Fuzzy Systems Toolbox September 29, 1999 35
T 0 2T 3T
e(T) + e(2T)
2
= f(2T)
2
e(0) + e(T)
= f(T)
e(t)
t
f(0)
Fig. 41: Function f(hT).
5 Fuzzy Control
A fuzzy proportional integral controller with two inputs and one output is deﬁned in terms of piecewise
linear membership functions for fuzziﬁcation, control rules and a linear defuzziﬁcation algorithm. It
is shown that a fuzzy PIcontroller is not equivalent to a linear nonfuzzy PIcontroller if the rules are
evaluated using the Zadehlogic alone. However, it can be shown that a fuzzy PIcontroller is precisely
equivalent to a linear nonfuzzy PIcontroller if mixed fuzzy logic is used to evaluate the control rules.
Sources of nonlinearity in a fuzzy controller include the algorithm used for fuzziﬁcation, type of fuzzy
logic used for evaluating the fuzzy control rules, and the defuzziﬁcation algorithm used for the controller
output (14). Using a nonlinear defuzziﬁcation algorithm, we show that a fuzzy PIcontroller is equivalent
to a nonlinear nonfuzzy PIcontroller with proportional and integral gains changing with the error and
rate of change of error about a setpoint. Apart from this, the performance of a simple fuzzy PIcontroller
with linear and nonlinear defuzziﬁcation algorithms will be analysed following the basic ideas suggested
by Siler et al. (1988) (10) and Ying et al. (1990) (14).
5.1 Discrete PIcontroller
The PIcontrol action in analog controllers is given by
u(t) = K
p
· e(t) +K
i
·
_
t
0
e(t) dt (53)
where e(t) is the input to the controller (the actuating error signal), u(t) is the output of the controller
(the manipulating signal), K
p
and K
i
are the proportional and integral gains of the analog PIcontroller,
respectively. To obtain the pulse transfer function for the digital PIcontroller (9), equation (53) will be
discrete. The integral term is approximated to the trapezoidal area. The following equation is obtained :
u(nT) = K
p
· e(nT) +K
i
· T ·
_
e(0) +e(T)
2
+
e(T) +e(2T)
2
+· · · +
e((n −1)T) +e(nT)
2
_
= K
p
· e(nT) +K
i
· T ·
n
h=1
e((h −1)T) +e(hT)
2
(54)
Deﬁne
f(hT) =
e((h −1)T) +e(hT)
2
; f(0) = 0 (55)
Figure 41 shows the function f(hT). Then
n
h=1
e((h −1)T) +e(hT)
2
=
n
h=1
f(hT) (56)
Fuzzy Systems Toolbox September 29, 1999 36
Taking the z transform of this last equation, it is obtained
Z
_
n
h=1
e((h −1)T) + e(hT)
2
_
= Z
_
n
h=1
f (hT)
_
=
1
1 −z
−1
[F(z) −f(0)]
=
1
1 −z
−1
F(z) (57)
Notice that
F(z) = Z [f (hT)] =
1 + z
−1
2
E(z ) (58)
Hence,
Z
_
n
h=1
e((h −1)T) + e(hT)
2
_
=
1 + z
−1
2(1 −z
−1
)
E(z ) (59)
Then the z transform of equation (54) gives
U(z) =
_
K
p
+K
i
T(1 +z
−1
)
2(1 −z
−1
)
_
E(z) (60)
This last equation may be rewritten as follows :
U(z) =
_
K
p
+
K
i
· T
2
_
−1 +
2
1 −z
−1
__
E(z)
=
_
K
p
−
K
i
· T
2
+
K
i
· T
1 −z
−1
_
E(z)
=
_
K
p
D
+
K
i
D
1 −z
−1
_
E(z) (61)
where
K
p
D
= K
p
−
K
i
D
2
(62)
K
i
D
= K
i
· T (63)
Notice that the proportional gain K
p
D
for the digital PIcontroller is smaller than the proportional gain
K
p
of the analog PIcontroller by K
i
D
/2. The pulse transfer function of the digital PIcontroller becomes
G
D
(z) =
U(z)
E(z)
= K
p
D
+
K
i
D
1 −z
−1
(64)
5.2 Fuzzy PIcontroller with Linear Defuzziﬁcation
The relationship between a PIcontroller and a fuzzy PIcontroller, consisting of two inputs, rate of change
of error and error, one output and ﬁve fuzzy control rules, will be determined. The fuzzy partitions rate
and error have three fuzzy sets, and the fuzzy partition for controller output has ﬁve fuzzy sets. We will
concentrate on the fuzzy PIcontroller is not equivalent to a linear nonfuzzy PIcontroller if the rules are
evaluated using the Zadehlogic alone. However, it can be shown that a fuzzy PIcontroller is precisely
equivalent to a linear nonfuzzy PIcontroller if mixed fuzzy logic is used to evaluate the control rules
following the basic ideas indicated by Siler et al. (1988).
Description of the Fuzzy PIcontroller
An analog linear PIcontroller can be described by the following diﬀerential equation
du(t)
dt
= K
p
·
de(t)
dt
+K
i
· e(t) (65)
Fuzzy Systems Toolbox September 29, 1999 37
The error signal e(t) has to be diﬀerentiated,
du(t)
dt
integrated numerically within the control module to
produce the controller output u(t). Let deriv
(nT) be the rate of change of controller output, let rate
(nT)
be the rate of change of process error, and let error
(nT) be the diﬀerence between actual process output
and desired process output. The equation (65) in discrete time, can be rewritten as follows :
deriv
(nT) = K
p
· rate
(nT) +K
i
· error
(nT) (66)
where n is a positive integer, and T is a sampling period.
The last equation can be redeﬁned to make the rate of change of process output, the rate of change of
process error and the error of the process fall within the interval [1,1], without loss of generality. New
scaling parameters are deﬁned to deal with this objective. These parameters are G
u
, G
r
and G
e
, where
deriv
(nT) = G
u
· deriv(nT); G
r
· rate
(nT) = rate(nT) and G
e
· error
(nT) = error(nT). Substituting
these three equalities in the equation (66) is obtained the following result :
G
u
· deriv(nT) =
K
p
G
r
· rate(nT) +
K
i
G
e
· error(nT)
deriv(nT) =
K
p
G
u
· G
r
· rate(nT) +
K
i
G
u
· G
e
· error(nT) (67)
where error(nT) and rate(nT) denote the inputs of the fuzzy controller for fuzziﬁcation. The deriv(nT)
denotes the output of the fuzzy PIcontroller from defuzzifying the output fuzzy sets, deriv, at sampling
time nT.
The constants
K
p
G
u
·G
r
and
K
i
G
u
·G
e
are assumed equals to 0.5 to make deriv(nT) fall within the interval [1,1]
as long as rate(nT) and error(nT) fall within [1,1]. In other words, the fuzzy PIcontroller becomes the
PIcontroller with the proportional gain K
p
= 0.5 · G
u
· G
r
and K
i
= 0.5 · G
u
· G
e
. So, there are inﬁnitely
many combinations of G
e
, G
r
and G
u
to hold true these expressions (14).
Fuzziﬁcation Algorithm and Fuzzy Control Rules
Next step is to fuzzify error(nT) and rate(nT) into continuous fuzzy partitions which will be named
error and rate, and to compute a fuzzy partition deriv through rules which describe the controller.
It is assumed three sets in fuzzy partitions error and rate, and ﬁve sets in fuzzy partition deriv. The
three sets of error will be named error.n (negative), error.z (zero) and error.p (positive); and the
sets of rate will be named rate.n, rate.z and rate.p. The linear fuzziﬁcation algorithm, for error(nT)
and rate(nT), is shown in ﬁgure 42. The deﬁnition of the fuzzy sets deriv is shown in ﬁgure 43. The
fuzzy partition deriv has ﬁve sets, deriv.nl (negative large), deriv.ns (negative small), deriv.z (zero),
deriv.ps (positive small) and deriv.pl (positive large) with principal values −1, −0.5, 0, +0.5 and +1,
respectively.
The control rules are deﬁned of the form
Rule 1: IF error(nT) is error.n AND rate(nT) is rate.n
THEN deriv(nT) is deriv.nl
Rule 2: IF error(nT) is error.n AND rate(nT) is rate.z
OR error(nT) is error.z AND rate(nT) is rate.n
THEN deriv(nT) is deriv.ns
Rule 3: IF error(nT) is error.n AND rate(nT) is rate.p
OR error(nT) is error.z AND rate(nT) is rate.z
OR error(nT) is error.p AND rate(nT) is rate.n
THEN deriv(nT) is deriv.z
Rule 4: IF error(nT) is error.z AND rate(nT) is rate.p
OR error(nT) is error.p AND rate(nT) is rate.z
THEN deriv(nT) is deriv.ps
Rule 5: IF error(nT) is error.p AND rate(nT) is rate.p
THEN deriv(nT) is deriv.pl
Fuzzy Systems Toolbox September 29, 1999 38
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
ERROR.n ERROR.z ERROR.p
µ
error(nT)
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
RATE.n RATE.z RATE.p
µ
rate(nT)
Fig. 42: Fuzziﬁcation algorithm for the inputs of the fuzzy controller, error(nT) and rate(nT).
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
DERIV.nl DERIV.ns DERIV.z DERIV.ps DEVIR.pl
µ
deriv(nT)
Fig. 43: Fuzziﬁcation algorithm for the output of fuzzy PIcontroller.
The last set of rules can be rewritten after applying fuzziﬁcation to input variables error(nT) and
rate(nT) as follows :
Rule 1: µ
deriv.nl
(deriv(nT)) = t [µ
error.n
(error(nT)), µ
rate.n
(rate(nT))]
Rule 2: µ
deriv.ns
(deriv(nT)) = s
_
t[µ
error.n
(error(nT)), µ
rate.z
(rate(nT))],
t[µ
error.z
(error(nT)), µ
rate.n
(rate(nT))]
_
Rule 3: µ
deriv.z
(deriv(nT)) = s
_
_
_
t[µ
error.n
(error(nT)), µ
rate.p
(rate(nT))],
t[µ
error.z
(error(nT)), µ
rate.z
(rate(nT))],
t[µ
error.p
(error(nT)), µ
rate.n
(rate(nT))]
_
_
_
Rule 4: µ
deriv.ps
(deriv(nT)) = s
_
t[µ
error.z
(error(nT)), µ
rate.p
(rate(nT))],
t[µ
error.p
(error(nT)), µ
rate.z
(rate(nT))]
_
Rule 5: µ
deriv.pl
(deriv(nT)) = t [µ
error.p
(error(nT)), µ
rate.p
(rate(nT))]
Defuzziﬁcation Algorithm
The principal values of the N = 3 sets of the fuzzy partitions error and rate are equally spaced and
fall within the interval [−1, 1]. In the same way, there are 2N −1 sets of the fuzzy partition deriv, and
the range of the output deriv
L
(nT) will be restricted to [−1, 1], subject to external scaling. The principal
value or centre of the ith set of deriv is given by −1 + (i −1)/(N −1). The defuzziﬁcation is made
summing the principal values or centre of the sets of deriv weighted by their grades of membership
values µ
deriv
i
(deriv(nT)) as derived from the control rules (10).
deriv
L
(nT) =
2N−1
i=1
µ
deriv
i
(deriv(nT)) ·
_
−1 +
i −1
N −1
_
(68)
Fuzzy Systems Toolbox September 29, 1999 39
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
rate(nT)
e
r
r
o
r
(
n
T
)
−0.75
−0.5
−0.25
0
0
0.25
0.5
0.75
Fig. 44: Characteristics of linear nonfuzzy PIcontroller.
−1
−0.5
0
0.5
1
−1
−0.5
0
0.5
1
−1
−0.5
0
0.5
1
rate(nT)
error(nT)
d
e
r
i
v
(
n
T
)
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
rate(nT)
e
r
r
o
r
(
n
T
)
−0.75
−0.5
−0.25
0
0
0.25
0.5
0.75
Fig. 45: Characteristics of fuzzy PIcontroller with rules evaluated using Zadehlogic.
The value deriv
L
(nT) is integrated and scaled to obtain the actual controller output. If a member of
deriv has principal value zero, it does not need to be included in the control rules since its grade of
membership is multiplied by zero in the defuzziﬁcation procedure.
Rule Evaluation
The control rules will be evaluated using the Zadehlogic. If µ
A
and µ
B
represent the grades of member
ship of fuzzy sets A and B, respectively. The Zadehlogic is deﬁned as :
t[µ
A
, µ
B
] = min(µ
A
, µ
B
), s[µ
A
, µ
B
] = max(µ
A
, µ
B
) (69)
Characteristics of the fuzzy PIcontroller with rules evaluated using Zadehlogic are shown in ﬁgure
45. The control is linear in the second and fourth quadrants, but is hyperlinear in the ﬁrst and third
quadrants. In other words, the fuzzy PIcontroller using Zadehlogic gives greater output than the linear
nonfuzzy PIcontroller.
In the same way, the rules will be evaluated using appropriate mixed fuzzy logics. Firstly, we use
the Zadehlogic for Rule 1 and Rule 5, the Lukasiewiczlogic
1
for and of Rule 2 and Rule 4, and the
Lukasiewiczlogic for the or of Rule 2 and Rule 4. Finally, we use Lukasiewiczlogic for Rule 1 and Rule
5, Zadehlogic for the and of Rule 2 and Rule 4, and Lukasiewiczlogic for the or of Rule 2 and Rule 4.
Results are shown in ﬁgure 46.
1
t[µ
A
, µ
B
] = max(0, (µ
A
+ µ
B
) −1); s[µ
A
, µ
B
] = min(1, µ
A
+ µ
B
)
Fuzzy Systems Toolbox September 29, 1999 40
−1
−0.5
0
0.5
1
−1
−0.5
0
0.5
1
−1
−0.5
0
0.5
1
rate(nT)
error(nT)
d
e
r
i
v
(
n
T
)
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
rate(nT)
e
r
r
o
r
(
n
T
)
−0.75
−0.5
−0.25
0
0
0.25
0.5
0.75
Fig. 46: Characteristics of fuzzy PIcontroller with rules evaluated using appropriate mixed logic.
0 100 200 300 400 500 600 700 800 900 1000
0
0.2
0.4
0.6
0.8
1
1.2
1.4
O
u
t
p
u
t
time (sec)
Fuzzy PI
PI
0 100 200 300 400 500 600 700 800 900 1000
0
0.2
0.4
0.6
0.8
1
1.2
1.4
O
u
t
p
u
t
time (sec)
Fuzzy PI
PI
Fig. 47: Response of the coupled tanks under control of a fuzzy PIcontroller with rules evaluated using
appropriate mixed logic (left) and Zadehlogic (right).
Computer Simulation Results
A secondorder process model was employed to determine the control performance of the fuzzy PI
controller. This model describes the coupled tanks apparatus available in the laboratory of the Control
Systems Centre (1). The transfer function, assuming a steady state operating condition with a pump
ﬂow rate of 900cm
3
/min, is given as follows :
G(s) =
1
2.37
1149.293 s
2
+ 111.834 s + 1
(70)
The fuzzy PIcontroller was set to equal the proportional gain K
p
and the integral gain K
i
of the discrete
PIcontroller. In other word, K
p
= 0.5 · G
r
· G
u
and K
i
= 0.5 · G
e
· G
u
. The provided proportionalgain
and integralgain were calculated to set the integral action time constant to 50sec and to give a closed
loop damping factor of ζ = 0.7 (1).
The result of the fuzzy PIcontroller using appropriate mixed fuzzy logics is shown in ﬁgure 47, and
no diﬀerence in control performance between the discrete PIcontroller and the fuzzy PIcontroller can
be observed. However, the fuzzy PIcontroller using Zadehlogic shows a little diﬀerence in control
performance. The hyperlinear control furnished in ﬁrst and third quadrants might well be a desirable
characteristic.
Figure 48 illustrates the trajectory described by the fuzzy controller inputs, error(nT) and rate(nT),
and provides an alternative way to observe how much the controlled system could be aﬀected by the
Fuzzy Systems Toolbox September 29, 1999 41
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
rate(nT)
e
r
r
o
r
(
n
T
)
−0.75
−0.5
−0.25
0
0
0.25
0.5
0.75
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
rate(nT)
e
r
r
o
r
(
n
T
)
−0.75
−0.5
−0.25
0
0
0.25
0.5
0.75
Fig. 48: This ﬁgures combine the characteristic of fuzzy PIcontroller with rules evaluated using appro
priate mixed logic (left) and Zadehlogic (right), and the trajectory described by the fuzzy controller
inputs, error(nT) and rate(nT).
nonlinearity of the fuzzy PIcontroller.
5.3 Fuzzy PIcontroller with Nonlinear Defuzziﬁcation
The relationship between a PIcontroller and a smallest possible fuzzy PIcontroller, consisting of two
inputs, rate of change of error and error, one output and four fuzzy control rules, will be established. The
fuzzy partitions rate and error have two fuzzy sets, and the fuzzy partition for controller output has
three fuzzy sets. We will focus on the nonlinearity introduced by the defuzziﬁcation algorithm, and prove
theoretically that a fuzzy controller with a nonlinear defuzziﬁcation algorithm is precisely equivalent to
a nonlinear PIcontroller, where proportional gain and integral gain change with error and rate inputs.
Description of the Fuzzy PIcontroller
In general, fuzzy PIcontrollers employ error and rate about a setpoint as their inputs, as shown in the
block diagram 58. The following notation will be used :
error
(nT) = setpoint −y(nT) (71)
error(nT) = G
e
· error
(nT) (72)
rate
(nT) =
error
(nT) −error
((n −1)T)
T
(73)
rate(nT) = G
r
· rate
(nT) (74)
deriv
(nT) = G
u
· deriv(nT) (75)
u(nT) = T · deriv
(nT) +u((n −1)T) (76)
where n is a positive integer and T is a sampling period. The error
(nT), rate
(nT), y(nT) and u(nT)
denote error, rate, process output and output from the fuzzy PIcontroller (process input) at sampling
time nT. The error(nT) and rate(nT) denote the inputs of the fuzzy PIcontroller for fuzziﬁcation. The
error
((n −1)T) and u((n −1)T) are the error and the output from the fuzzy PIcontroller at sampling
time (n −1)T, respectively. G
e
(gain for error) is the input scaler for error, G
r
(gain for rate) is the input
scaler for rate, and G
u
(gain for controller output) is the output scaler of the fuzzy PIcontroller. The
deriv
(nT) designates the incremental output of fuzzy PIcontroller at sampling time nT. The deriv(nT)
denotes the incremental output of the fuzzy PIcontroller from defuzzifying the output fuzzy set, deriv,
at sampling time nT.
Fuzzy Systems Toolbox September 29, 1999 42
uod Rate
uod Error
Zero−Order
Hold1
Zero−Order
Hold
uod_Error
To Workspace4
uod_Rate
To Workspace3
FC_output
To Workspace2
Output_H2
To Workspace1
Sum2
Sum1
Sum
Step
fuzzy_pi_li1_s
S−Function
Output H2
Mux
Mux1
Mux
Mux
7.5
Kp
0.15
Ki
15
Gu
1
Gr=
Kp/(0.5*Gu)
0.02
Ge=
Ki/(0.5*Gu)
FC output
T(z+1)
2(z−1)
Discrete−Time
Integrator1
Tz
z−1
Discrete−Time
Integrator
1−z
−1
1
Discrete
Filter1
1/2.37
1149.293s +111.834s+1
2
Coupled tanks1
1/2.37
1149.293s +111.834s+1
2
Coupled tanks
Fig. 49: Block diagram shows the coupled tanks model under control of a fuzzy PIcontroller and a
discrete PIcontroller. The block diagram is implemented in SIMULINK
TM
using the Fuzzy System
Toolbox (FSTB) (13).
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1 ERROR.n ERROR.p
µ
error(nT)
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1 RATE.n RATE.p
µ
rate(nT)
Fig. 50: Fuzziﬁcation algorithm for the inputs of the fuzzy controller, error(nT) and rate(nT).
Fuzziﬁcation Algorithm and Fuzzy Control Rules
The fuzzy sets of error will be named error.p (positive) and error.n (negative), and the fuzzy sets of
rate will be named rate.p and rate.n. The fuzzy partitions for the variables error(nT) and rate(nT),
are shown in ﬁgure 50. The deﬁnition of the fuzzy partition deriv is shown in ﬁgure 51. deriv has three
sets, deriv.p (positive), deriv.z (zero) and deriv.n (negative).
There are four linear fuzzy control rules used in the fuzzy PIcontroller :
Rule 1: IF error(nT) is error.n AND rate(nT) is rate.n THEN deriv(nT) is deriv.n
Rule 2: IF error(nT) is error.n AND rate(nT) is rate.p THEN deriv(nT) is deriv.z
Rule 3: IF error(nT) is error.p AND rate(nT) is rate.n THEN deriv(nT) is deriv.z
Rule 4: IF error(nT) is error.p AND rate(nT) is rate.p THEN deriv(nT) is deriv.p
Defuzziﬁcation Algorithm
The centre average defuzziﬁer is the nonlinear defuzziﬁcation algorithm used. It amounts to a normal
ization of the membership values of the fuzzy set being defuzziﬁed. The principal value or centre of the
ith fuzzy set of deriv is given by −1 + (i −1)/(N −1), and the grades of membership values derived
Fuzzy Systems Toolbox September 29, 1999 43
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
DERIV.n DERIV.z DERIV.p
µ
deriv(nT)
Fig. 51: Fuzziﬁcation algorithm for the incremental output of fuzzy controller.
IC3
IC4
IC1 IC2
IC8
IC7
IC6 IC5
Gr * rate’(nT)
Ge * error’(nT)
RATE.n
RATE.n
RATE.n
ERROR.n
ERROR.n
RATE.n
ERROR.n
ERROR.n RATE.n
RATE.n
RATE.n
RATE.n
ERROR.p
ERROR.p
ERROR.p
ERROR.p
ERROR.n
ERROR.n
ERROR.n
ERROR.n
RATE.p
RATE.p
RATE.p
RATE.p
RATE.p
RATE.p
ERROR.p
ERROR.p
ERROR.p
ERROR.p
RATE.p
RATE.p
Rule 1 Rule 2 Rule 3 Rule 4
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
IC1
IC2
IC3
IC4
IC5
IC6
IC7
IC8
Fig. 52: Results of evaluating the fuzzy control rules for all combinations of inputs using Zadehand.
from the control rules, are given by µ
deriv
i
(deriv(nT)). So, the defuzziﬁed output of the fuzzy partition
deriv is deﬁned as (12).
deriv
NL
(nT) =
2N−1
i=1
µ
deriv
i
(deriv(nT)) ·
_
−1 +
i−1
N−1
_
2N−1
i=1
µ
deriv
i
(deriv(nT))
(77)
The nonlinearity is introduced into the defuzziﬁcation algorithm by the denominator.
A Fuzzy PIcontroller and a Nonlinear Nonfuzzy PIcontroller
The fuzzy logic will be Zadehlogic for evaluation of the fuzzy control rules. Since Zadehand is the
minimum of two values, two diﬀerent conditions arise for each rule; one when the membership value
of error(nT) is less than the membership value of rate(nT), and one when the membership value of
rate(nT) is less than the membership value of error(nT). The eight diﬀerent combinations of error(nT)
and rate(nT) constituting the inputs to the control rules are shown in ﬁgure 52, where IC is the Input
Combination of error(nT) and rate(nT).
We can show that the fuzzy PIcontroller is a conventional nonlinear nonfuzzy PIcontroller with changing
proportional and integral gains. The results of evaluating the fuzzy control rules Rule 1, Rule 2, Rule
3, and Rule 4 using Zadehand are given in ﬁgure 52. µ
error.p
and µ
error.n
(µ
rate.p
and µ
rate.n
) mean
the membership values of error.p and error.n (rate.p and rate.n) in the fuzzy sets error (rate).
Notice that
µ
error.p
(error(nT)) =
error(nT) + 1
2
=
G
e
· error
(nT) + 1
2
(78)
Fuzzy Systems Toolbox September 29, 1999 44
µ
error.n
(error(nT)) =
−error(nT) + 1
2
=
−G
e
· error
(nT) + 1
2
(79)
µ
rate.p
(rate(nT)) =
rate(nT) + 1
2
=
G
r
· rate
(nT) + 1
2
(80)
µ
rate.n
(rate(nT)) =
−rate(nT) + 1
2
=
−G
r
· rate
(nT) + 1
2
(81)
When the Zadehor is used for the membership values of the member deriv.z in Rule 2 and Rule 3,
deriv
NL
(nT) can be described by the following equations obtained from the nonlinear defuzziﬁcation
algorithm deriv
NL
(nT) :
IC1 and IC2
deriv
NL
(nT) =
(−1) · µ
error.n
+ (1) · µ
rate.p
µ
error.n
+µ
rate.n
+µ
rate.p
=
G
e
· error
(nT) +G
r
· rate
(nT)
3 −G
e
· error
(nT)
(82)
IC3 and IC4
deriv
NL
(nT) =
(−1) · µ
rate.n
+ (1) · µ
error.p
µ
rate.n
+µ
error.n
+µ
error.p
=
G
r
· rate
(nT) +G
e
· error
(nT)
3 −G
r
· rate
(nT)
(83)
IC5 and IC6
deriv
NL
(nT) =
(−1) · µ
rate.n
+ (1) · µ
error.p
µ
rate.n
+µ
rate.p
+µ
error.p
=
G
r
· rate
(nT) +G
e
· error
(nT)
3 +G
e
· error
(nT)
(84)
IC7 and IC8
deriv
NL
(nT) =
(−1) · µ
error.n
+ (1) · µ
rate.p
µ
error.n
+µ
error.p
+µ
rate.p
=
G
e
· error
(nT) +G
r
· rate
(nT)
3 +G
r
· rate
(nT)
(85)
If G
r
·  rate
(nT)  ≤ G
e
·  error
(nT) ≤ 1
deriv
NL
(nT) =
G
e
· error
(nT) +G
r
· rate
(nT)
3 −G
e
·  error
(nT) 
(86)
If G
e
·  error
(nT)  ≤ G
r
·  rate
(nT) ≤ 1
deriv
NL
(nT) =
G
e
· error
(nT) +G
r
· rate
(nT)
3 −G
r
·  rate
(nT) 
(87)
The fuzzy PIcontroller is precisely equivalent to a linear nonfuzzy PIcontroller with proportional gain
K
p
= 0.5 · G
u
· G
r
and the integral gain K
i
= 0.5 · G
u
· G
e
, and
deriv
(nT) = K
p
· rate
(nT) +K
i
· error
(nT) (88)
if the linear defuzziﬁcation algorithm is employed.
Fuzzy Systems Toolbox September 29, 1999 45
−1
−0.5
0
0.5
1
−1
−0.5
0
0.5
1
−1
−0.5
0
0.5
1
rate(nT)
error(nT)
d
e
r
i
v
(
n
T
)
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
rate(nT)
e
r
r
o
r
(
n
T
)
−0.75
−0.5
−0.25
0
0
0.25
0.5
0.75
Fig. 53: Characteristics of fuzzy PIcontroller with control rules evaluated using Zadehlogic and centre
average defuzziﬁer.
Comparing equation (88) with equations (86) and (87), it is obvious that the fuzzy PIcontroller with
Zadehlogic and centre average defuzziﬁcation is a nonlinear PIcontroller with K
p
and K
i
changing with
error
(nT) and rate
(nT). The proportional gain K
p
and integral gain K
i
are :
K
p
=
G
r
· G
u
3 −G
e
·  error
(nT) 
(89)
K
i
=
G
e
· G
u
3 −G
e
·  error
(nT) 
(90)
when G
r
·  rate
(nT)  ≤ G
e
·  error
(nT)  ≤ 1, and
K
p
=
G
r
· G
u
3 −G
r
·  rate
(nT) 
(91)
K
i
=
G
e
· G
u
3 −G
r
·  rate
(nT) 
(92)
when G
e
·  error
(nT)  ≤ G
r
·  rate
(nT)  ≤ 1.
The static proportional gain K
p
S
and static integral gain K
i
S
are deﬁned as the proportional gain and
the integral gain when both error
(nT) and rate
(nT) are equal to zero. According to equations (89),
(90), (91) and (92), the static proportional gain K
p
S
and static integral gain K
i
S
for the fuzzy controller
using the nonlinear defuzziﬁcation algorithm deriv
NL
(nT) are :
K
p
S
=
G
r
· G
u
3
(93)
K
i
S
=
G
e
· G
u
3
(94)
Computer Simulation Results
Consider the digital control system shown in ﬁgure 54, where the plant is ﬁrst order one and has a dead
time of 0.2 seconds. A digital PIcontroller will be design below. The dominant closedloop poles will
have a damping ratio ζ of 0.5, the number of samples per cycle of damped sinusoidal oscillation
w
s
w
d
will
be 20, and the sampling period T will be assumed to equal 0.1 seconds.
Fuzzy Systems Toolbox September 29, 1999 46
Ts
e e
0.2s
D
G (z)
1 
+ 1 s s

r(t)
R(z)
y(t)
Y(z)
T
+
Fig. 54: Digital control system.
0.9048
1
0.7933 + j0.2578
18
o
Re
Im
P
0.8300
Fig. 55: Pole and zero location in the z plane.
The pulse transfer function of the plant which is preceded by a zeroorder hold is
G(z) = Z
_
1 −e
−Ts
s
·
e
−2T·s
s + 1
_
= (1 −z
−1
)z
−2
· Z
_
1
s(s + 1)
_
= z
−2
·
(1 −e
−0.1
)z
−1
1 −e
−0.1
z
−1
=
0.0952
z
2
(z −0.9048)
(95)
The digital PIcontroller has the following pulse transfer function :
G
D
(z) = K
p
D
+K
i
D
1
1 −z
−1
= (K
p
D
+K
i
D
)
z −
K
p
D
K
p
D
+K
i
D
z −1
(96)
The openloop pulse transfer function becomes
G
D
(z) · G(z) = (K
p
D
+K
i
D
)
z −
K
p
D
K
p
D
+K
i
D
z −1
·
0.0952
z
2
(z −0.9048)
(97)
The openloop poles in the z plane are shown in ﬁgure 55. There is one openloop zero involved in this
case, but its location is unknown at this point. The desired closedloop pole location can be determined
as follows (8) :
 z  = exp
_
−
2πζ
_
1 −ζ
2
w
d
w
s
_
(98)
∠z = 2π
w
d
w
s
(99)
Since it is required to have 20 samples per cycle of damped sinusoidal oscillation, the dominant closed
loop pole in the upper half of the z plane must lie on a line from the origin having an angle of
∠z = 2π
w
d
w
s
= 2π/20 = 0.3142 = 18
◦
. Since ζ is speciﬁed as 0.5, the module of the closeloop pole is
 z = exp
_
−
2π · 0.5
√
1 −0.5
2
1
20
_
= 0.8341 (100)
Fuzzy Systems Toolbox September 29, 1999 47
The closedloop pole is located at point P in ﬁgure 55, where
z = 0.8341 ∠18
◦
= 0.7933 +j0.2578 (101)
If point P is the closedloop pole located in the upper half of the z plane, then the angle of the openloop
zero at point P is
−18
◦
−18
◦
−113.39
◦
−128.72
◦
+α = −180
◦
(102)
α = 98.11
◦
(103)
This means that the zero of the digital controller must be located at z = 0.8300. Therefore
K
p
D
K
p
D
+K
i
D
= 0.8300 (104)
Hence the PIcontroller is determined as follows :
G
D
(z) = K
z −0.8300
z −1
(105)
where K = K
p
D
+K
i
D
. Gain constant K is determined from the magnitude condition :
1 −K
¸
¸
¸
¸
z −0.8300
z −1
0.0952
z
2
(z −0.9048)
¸
¸
¸
¸
z=0.7933+j0.2578
= 0 (106)
K = K
p
D
+K
i
D
= 2.6050 (107)
K
p
D
= 2.1621 (K
p
= 2.3835) (108)
K
i
D
= 0.4429 (K
i
= 4.4290) (109)
The ﬁrstorder process with time delay described above was employed to determine the control perfor
mance of the fuzzy PIcontroller. The fuzzy PIcontroller produced less overshoot than the PIcontroller,
as shown in ﬁgure 56. The static proportional gain K
p
S
and the static integral gain K
i
S
of the fuzzy
PIcontroller were set to equal the proportional gain K
p
and the integral gain K
i
, respectively, of the
discrete PIcontroller. In other words, K
p
=
G
r
·G
u
3
= 2.3835 and K
i
=
G
e
·G
u
3
= 4.4290.
To compare the PIcontroller to the fuzzy PIcontroller using the nonlinear defuzziﬁcation deriv
NL
(nT),
the PIcontroller can be expressed by the following equation
deriv
PI
(nT) =
K
p
G
u
· rate
(nT) +
K
i
G
u
· error
(nT)
=
G
r
· rate
(nT) +G
e
· error
(nT)
3
(110)
If equation (110) is compared with equations (86) and (87), it is obtained the following inequalities (14) :
1
3 −G
e
· error
(nT)
≥
1
3
(111)
when G
r
·  rate
(nT)  ≤ G
e
·  error
(nT)  ≤ 1, and
1
3 −G
r
· rate
(nT)
≥
1
3
(112)
when G
e
·  error
(nT)  ≤ G
r
·  rate
(nT)  ≤ 1. In other words,
deriv
NL
(nT) ≥ deriv
PI
(nT) (113)
when G
e
·  error
(nT)  ≤ 1 and G
r
·  rate
(nT)  ≤ 1. According to equations (110), (111) and (112),
as well as, equations (86) and (87), we can conclude :
Fuzzy Systems Toolbox September 29, 1999 48
0 1 2 3 4 5 6 7 8 9 10
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
O
u
t
p
u
t
time (sec)
Fuzzy PI
PI
Fig. 56: Response of a ﬁrstorder process with time delay
Y (s)
U(s)
=
1
s+1
· e
−0.2s
under control of a fuzzy
PIcontroller and a discrete PIcontroller. Sampling period T = 0.1, K
p
= 2.3835, K
i
= 4.4290.
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
rate(nT)
e
r
r
o
r
(
n
T
)
−0.75
−0.5
−0.25
0
0
0.25
0.5
0.75
Fig. 57: This ﬁgure combines the characteristics of fuzzy PIcontroller with control rules evaluated using
Zadehlogic and centre average defuzziﬁer, and the trajectory described by the fuzzy controller inputs,
error(nT) and rate(nT).
• When error
(nT) = 0 and/or rate
(nT) = 0,  deriv
NL
(nT) = deriv
PI
(nT) . Otherwise,
 deriv
NL
(nT)  >  deriv
PI
(nT) .
• The larger  error
(nT)  ( rate
(nT) ) is, the larger the diﬀerence between  deriv
NL
(nT)  and
 deriv
PI
(nT) . On the other hand, when the process output is near the setpoint and the rate is
near zero, the control action of the fuzzy PIcontroller is similar to the PIcontroller. That ensures
zero steadystate error of the fuzzy control system.
• The fuzzy controller could control the timedelay process model signiﬁcantly better than the non
fuzzy discrete PIcontroller, due to the nonlinearities of the fuzzy controller. The degree of nonlin
earities of the fuzzy controller can be changed by adjusting the input scalers G
e
and G
r
. Once G
e
and G
r
are selected, G
u
can be uniquely determined to satisfy expressions (93) and (94)(14).
5.4 Demonstration Files
The Fuzzy System Toolbox (FSTB) provides eleven demonstration ﬁles. They are script ﬁles and may
also serve as a kind of user’s guide. Execute the demonstration ﬁles from the MATLAB
TM
workspace.
The demonstration ﬁles which are related to the chapter, are shown as follows :
Fuzzy Systems Toolbox September 29, 1999 49
uod Rate
uod Error
Zero−Order
Hold1
Zero−Order
Hold
1
s+1
Transfer Fcn1
1
s+1
Transfer Fcn
uod_Error
To Workspace4
uod_Rate
To Workspace3
FC_output
To Workspace2
Output_H2
To Workspace1
0.2
Time delay
Sum3
Sum2
Sum
Step
fuzzy_pi_za2_s
S−Function
Output H2
Mux
Mux1
Mux
Mux
2.3835
Kp
4.4290
Ki
50
Gu
0.1430
Gr=
Kp*3/Gu
0.2657
Ge=
Ki*3/Gu
FC output
T(z+1)
2(z−1)
Discrete−Time
Integrator1
Tz
z−1
Discrete−Time
Integrator
1−z
−1
0.1
Discrete
Filter1
Delay2
Delay
Fig. 58: Block diagram shows the ﬁrstorder process with time delay under control of the fuzzy PI
controller and a discrete PIcontroller. The block diagram is implemented in SIMULINK
TM
using the
Fuzzy System Toolbox (FSTB) (13).
fuz demo2: The commands employed by this demo are given below:
1. plot set() (vector representation).
2. plot function(), fuzzy p().
3. modsuset().
4. con2dis().
5. fuzzy pi 35(), plot contour(), plot surf().
fuzzy pi 23 demo: This ﬁle demonstrates two fuzzy PIcontrollers, fuzzy pi 23 and
fuzzy pi 23 nld. The type of controller can be selected from the menu “Controller”. This demo
also allows selection of input fuzzy sets, output fuzzy sets, the tnorm operator and the snorm
operator. After selecting all mentioned variables; characteristics of fuzzy PIcontroller, input fuzzy
sets, and output fuzzy sets appear on the window.
The input fuzzy sets and output fuzzy sets are considered as fullyoverlapping triangular fuzzy sets.
A general process under control of the selected fuzzy PIcontroller could be executed. A new
SIMULINK diagram called “fuzzy controller demo” appears after clicking on the soft button called
“Simulation”. The module “Transfer Fnc” can be changed and a new process can be studied. The
SIMULINK diagram has two parts; the ﬁrst one is the process under control of the deﬁned fuzzy
PIcontroller, and the second part is the same process under a discrete PIcontroller. A comparison
between those PIcontrollers over the same process can be made. The timedelay and delay boxes
permit to add delay time to the process. If no time delay wants to be added, the time delay box
must be set to zero.
After stopping the simulation, the trajectory described by fuzzy PIcontroller inputs appears on
the contour characteristic of the deﬁned fuzzy PIcontroller. See ﬁgure 59.
fuzzy pi 35 demo: This ﬁle demonstrates shows two fuzzy PIcontrollers, fuzzy pi 35 and
fuzzy pi 35 nld. The type of controller can be selected from the menu “Controller”. This demo
also allows selection of input fuzzy sets, output fuzzy sets, the tnorm operator and the snorm
operator. After selecting all mentioned variables; characteristics of fuzzy PIcontroller, input fuzzy
sets, and output fuzzy sets appear on the window.
The input fuzzy sets and output fuzzy sets are considered as fullyoverlapping triangular fuzzy sets.
Fuzzy Systems Toolbox September 29, 1999 50
Fig. 59: fuzzy pi 23 demo.
Fig. 60: fuzzy pi 35 demo.
Fuzzy Systems Toolbox September 29, 1999 51
Fig. 61: fuzzy pi demo.
A general process under control of the selected fuzzy PIcontroller could be executed. A new
SIMULINK diagram called “fuzzy controller demo” appears after clicking on the soft button called
“Simulation”. The module “Transfer Fnc” can be changed and a new process can be studied. The
SIMULINK diagram has two parts; the ﬁrst one is the process under control of the deﬁned fuzzy
PIcontroller, and the second part is the same process under a discrete PIcontroller. A comparison
between those PIcontrollers over the same process can be made. The timedelay and delay boxes
permit to add delay time to the process. If no time delay wants to be added, the time delay box
must be set to zero.
After stopping the simulation, the trajectory described by fuzzy PIcontroller inputs appears on
the contour characteristic of the deﬁned fuzzy PIcontroller. See ﬁgure 60.
fuzzy pi demo: This demo shows ﬁve fuzzy PIcontrollers, fuzzy pi li1, fuzzy pi li2,
fuzzy pi li3, fuzzy pi za1 and fuzzy pi za2. The type of controller could be
selected from the menu called “Controller”. After selecting a PIcontroller; char
acteristics of fuzzy PIcontroller, input fuzzy sets, and output fuzzy sets appear on
the window.
A general process under control of the selected fuzzy PIcontroller could be executed.
A new SIMULINK diagram called “fuzzy controller demo” appears after clicking on
the soft button called “Simulation”. The module “Transfer Fnc” can be changed
and a new process can be studied. The SIMULINK diagram has two parts; the ﬁrst
one is the process under control of the deﬁned fuzzy PIcontroller, and the second
part is the same process under a discrete PIcontroller. A comparison between those
PIcontrollers over the same process can be made. The timedelay and delay boxes
permit to add delay time to the process. If no time delay wants to be added, the
time delay box must be set to zero.
After stopping the simulation, the trajectory described by fuzzy PIcontroller inputs
appears on the contour characteristic of the deﬁned fuzzy PIcontroller. See ﬁgure
61.
fuzzy pi za1 demo: This demo shows a sequence of windows from how the input variables of the fuzzy
PIcontroller were fuzzify until how the response of a coupled tank under control of the controller
fuzzy pi za1 would be.
Fuzzy Systems Toolbox September 29, 1999 52
Start this demo typing fuzzy pi za1 demo and follow the indication given on the screen. The
sequence of windows is described as follows :
1. Fuzziﬁcation algorithm for input error(nT) and rate(nT).
2. Fuzziﬁcation algorithm for the output of the fuzzy PIcontroller.
3. Characteristics of fuzzy PIcontroller with rules evaluated using Zadehlogic. This PIcontroller
is called fuzzy pi za1.
4. Characteristic of fuzzy PIcontroller with rules evaluated using appropriate mixed logic. This
controller was designed following the basic ideas suggested by Siler et. al. (1988). This
controller is called fuzzy pi li1.
5. A SIMULINK diagram called “fuzzy controller tanks” is run up. A linear model of the cou
pled tank available in the Control Systems Centre is oﬀered. The fuzzy controller is set to
fuzzy pi za1. After ﬁnishing the simulation, the response of the process and trajectory de
scribed by fuzzy controller inputs is display on a new window.
fuzzy pi za2 demo: This demo shows a sequence of windows from how the input variables of the fuzzy
PIcontroller were fuzzify until how the response of a ﬁrstorder process with time delay under
control of the controller fuzzy pi za2 would be.
Start this demo typing fuzzy pi za2 demo and follow the indication given on the screen. The
sequence of windows is described as follows :
1. Fuzziﬁcation algorithm for input error(nT) and rate(nT).
2. Fuzziﬁcation algorithm for the output of the fuzzy PIcontroller.
3. Characteristics of fuzzy PIcontroller with control rules evaluated using Zadehlogic and centre
average defuzziﬁer. This controller was designed following the basic ideas suggested by Ying
et al. (1990). This controller is called fuzzy pi za2.
4. A SIMULINK diagram called “fuzzy controller delay” is run up. A ﬁrstorder process with
time delay is oﬀered. The fuzzy controller is set to fuzzy pi za2. After ﬁnishing the simula
tion, the response of the process and trajectory described by fuzzy controller inputs is display
on a new window.
6 Conclusions: Fuzzy Control
Fuzzy control and conventional control try to solve the same kind of problems, that is, control problems.
Therefore, they must address the same issues that are common to any control problem, for example,
stability and performance. In addition, the mathematical tools used to analyze the designed control
systems are similar. In fact, if a process is well described by a linear model there is no need to consider
a fuzzy controller. Control theory provides well established control design methodologies. We also found
that fuzzy controllers are nonlinear controllers. Therefore, they are particularly useful in controlling
nonlinear systems.
The fuzzy PIcontroller with linear defuzziﬁcation algorithm was set to equal the proportional gain K
p
and
the integral gain K
i
of the discrete PIcontroller. In other word, K
p
= 0.5 · G
r
· G
u
and K
i
= 0.5 · G
e
· G
u
.
The result of the fuzzy PIcontroller using appropriate mixed fuzzy logics is shown in ﬁgure 47, and no
diﬀerence in control performance between the discrete PIcontroller and the fuzzy PIcontroller could
be observed. However, the fuzzy PIcontroller using Zadehlogic shows a little diﬀerence in control
performance. The hyperlinear control furnished in ﬁrst and third quadrants might well be a desirable
characteristic.
A ﬁrstorder process with time delay was employed to determine the control performance of the fuzzy
PIcontroller with Zadehlogic and centre average defuzziﬁcation. The fuzzy PIcontroller produced less
overshoot than the PIcontroller. The static proportional gain K
p
S
and the static integral gain K
i
S
of
the fuzzy PIcontroller were set to equal the proportional gain K
p
and the integral gain K
i
, respectively,
of the discrete PIcontroller. According to equations (110), (111) and (112), as well as, equations (86)
Fuzzy Systems Toolbox September 29, 1999 53
and (87), and following the ideas suggested by Siler et al. (1988) (10) and Ying et al. (1990) (14), we
can conclude:
Firstly, when the error signal of the process is equal to zero and/or the rate of change of the error signal
is equal to zero, the defuzziﬁed output of the fuzzy PIcontroller and the rate of change of output of
the discrete PIcontroller have the same magnitude. Otherwise, the output of the fuzzy PIcontroller is
bigger than the rate of change of output of the discrete PIcontroller.
Secondly, the larger the error signal (the rate of change of the error signal) is, the larger the diﬀerence
between the defuzziﬁed output of the fuzzy PIcontroller and the rate of change of output of the discrete
PIcontroller. On the other hand, when the process output is near the setpoint and the rate of change is
near zero, the control action of the fuzzy PIcontroller is similar to the PIcontroller. That ensures zero
steadystate error of the fuzzy control system.
Finally, the fuzzy controller controlled the timedelay process model signiﬁcantly better than the nonfuzzy
discrete PIcontroller. The degree of nonlinearities of the fuzzy controller can be changed by adjusting
the input scalers G
e
and G
r
. Once G
e
and G
r
are selected, G
u
can be uniquely determined (14).
The fuzzy PIcontrollers mentioned before are available in some demonstration ﬁles. These demo ﬁles
allow selection of input fuzzy sets, output fuzzy sets, the tnorm operator, and the snorm operator.
In addition, a general process under control of the selected fuzzy PIcontroller could be executed using
SIMULINK
TM
.
Fuzzy Systems Toolbox September 29, 1999 54
References
[1] Control Systems Centre, UMIST, Manchester. (1996). Investigations into control systems using
CE2000 ICONtrol software  Modelling and control of the coupled tanks apparatus  Solutions.
[2] Control Systems Centre, UMIST, Manchester. (1997). Investigations into control systems using
CE2000 ICONtrol software  Modelling and control of the coupled tanks apparatus.
[3] DUBOIS, D., PRADE, H. (1980). Fuzzy sets and systems. Theory and applications. Academic Press,
Inc., London.
[4] KOSKO, B. (1992). Neural networks and fuzzy systems. PrenticeHall International, Inc., New
Jersey.
[5] KRUSE, R., GEBHARDT, J. and KLAWONN, F. (1994). Foundations of fuzzy systems. John Wiley
& Sons Ltd, England.
[6] MATLAB 5 (1996). Using MATLAB Graphics. The MathWorks, Inc., U.S.
[7] MATLAB 5.2 (1998). Using MATLAB. The MathWorks, Inc., U.S.
[8] OGATA, K. (1987). Discretetime control systems. PrenticeHall International, Inc., New Jersey.
[9] OGATA, K. (1995). Discretetime control systems. PrenticeHall International, Inc., New Jersey.
[10] SILER, W. and YING, H. (1988). Fuzzy control theory: The linear case. Fuzzy sets and systems.
33. pp 275290.
[11] SIMULINK 2 (1996). Using SIMULINK. The MathWorth, Inc., U.S.
[12] WANG, L. X. (1997). A course in fuzzy systems and control. PrenticeHall International, Inc.,
London.
[13] WOLKENHAUER, O. and EDMUNDS, J.M. (1996). A fuzzy system toolbox for use with
MATLAB
TM
. Fuzzy logic controllers in practice, pp 9/1  9/4. IEE.
[14] YING, H., SILER, W. and BUCKLEY, J. J. (1990). Fuzzy control theory: A nonlinear case. Auto
matica. 26. 3. pp 513520.
[15] ZIMMERMANN, H.J. (1996). Fuzzy set theory. Kluwer Academic Publishers, U.S.
55
This action might not be possible to undo. Are you sure you want to continue?
Use one of your book credits to continue reading from where you left off, or restart the preview.