You are on page 1of 43

COM623M1

INTELLIGENT SYSTEMS
Chapter 1
INTRODUCTION
Solving complex real-world problems requires complex systems that combine knowledge,
techniques and methodologies from various sources. As human beings can perform with
significant ease and rapidity several complex tasks such as parallel parking, recognising a
substantially changed face in a crowd etc. which are still extremely difficult to be accomplished
by a modern high speed computer, one important approach to designing complex systems is to
incorporate human-like abilities. The systems designed, following this approach mainly, fall into
the category of Intelligent Systems. The intelligent systems are thus supposed to possess human-
like expertise within a specific domain; reason and explain how they make decisions or take
actions; learn, adapt and evolve themselves to do better in changing environment. This module
therefore aims to introduce basic fundamentals of computationally emulating human reasoning,
learning, adaptation and evolution for constructing computationally intelligent systems with the
help of three important computing paradigms fuzzy logic, neural networks and genetic
algorithms. Fuzzy logic appears to capture very well the approximate reasoning capability of
human beings. Neural networks provide an excellent framework for emulating learning and
adaptation ability of human beings through supervised and unsupervised training based on
experimental data. Drawing inspiration from Darwins theory of evolution, genetic algorithms
make possible efficient search and optimisation to design efficient systems through a simulated
genetic evolution procedure. Thus, fuzzy logic, neural networks, and genetic algorithm, either
alone or jointly as a hybrid approach, provide an excellent framework to design an intelligent
system.
1.1 Rationale
The module is designed to introduce the student to the research area of intelligent techniques such
as fuzzy logic, neural networks and genetic algorithms. This module is structured in four parts.
The first introduces the student to the methods of approximate reasoning and fuzzy systems. The
second part concentrates on neural networks and the learning algorithms required. The third part
describes the area of optimization and search routines using genetic algorithms. The final part
describes hybrid approaches involving combinations of the three techniques.
The emphasis of the module is on the design and implementation of intelligent technologies.
This will involve practical implementations through a software approach using the MATLAB
environment.
1.2 Aims and Learning Outcomes
The aims of the module are to introduce final year students to the research domain of Intelligent
Systems and to provide both a theoretical and practical description of how such systems are
designed and implemented.
Upon the successful completion of this module a successful student should be able to:
Understand, design and implement an approximate reasoning system using fuzzy logic
Understand, design and implement a learning system using neural networks
Understand, design and implement an optimisation and search system using genetic
algorithms
Conceptualise a hybrid intelligent system which combines the complementary aspects of
each technology
1.3 Outline of Module Content
Module content involves linear algebra and elementary vector calculus. The required
mathematical concepts would briefly be reviewed as part of module study. References are
provided for further and detailed study. MATLAB and its toolboxes are widely used for
simulation studies and experimental work.
To start with the module introduces fuzzy logic. Fundamental concepts of fuzzy logic are
discussed first. For ease of understanding, complex mathematical details are explained with
simple numerical examples. To demonstrate the complete design process of a fuzzy system,
application of fuzzy logic in the design of a fuzzy controller for water level control in a tank is
discussed in detail. The effectiveness of the fuzzy controller is then demonstrated by analysing
the test results obtained from a software simulation under MATLAB computing environment.
The module then goes on to discuss neural networks. After briefly mentioning the biological
origin of neural networks, main elements of a typical neural networks are explained. Neural
networks can broadly be classified into two categories: supervised neural networks and
unsupervised neural networks. The design of a set of representative examples is discussed in both
the categories.
Fundamental concepts of genetic algorithm (GA) are explained in the third section of the module.
Each of the algorithm design steps is illustrated through typical numerical examples. In the final
section, hybrid systems incorporating more than one intelligent system design techniques are
briefly discussed.
Chapter 2
FUZZY LOGIC
2.1 Introduction
Fuzzy Logic (FL) was invented by Professor Lotfi Zadeh in 1969 at the University of California
Berkley. It was initially presented as a way of processing data by allowing partial set
membership rather than crisp set membership or non-membership. Professor Zadeh reasoned that
people do not require precise, numerical information input, and yet they are capable of highly
adaptive control. If feedback controllers could be programmed to accept noisy, imprecise input,
they would be much more effective and perhaps easier to implement. However, this approach to
set theory was not applied to control systems until the 70's due to insufficient computing
capability prior to that time and a general reluctance within the academic community.
FL is a problem-solving methodology that lends itself to implementation in a range of systems
particularly control systems. It can be implemented in hardware, software, or a combination of
both. FL provides a simple way to arrive at a definite conclusion based upon vague, ambiguous,
imprecise, noisy, or missing input information. FL's approach to control problems mimics the
human reasoning process. It incorporates a simple, rule-based IF X AND Y THEN Z approach to
solving a problem rather than attempting to model a system mathematically (where X, Y and Z
are fuzzy sets). The FL model is empirically-based, relying on a human operator's experience
rather than his/her technical understanding of the system.
For example, consider what you do in the shower if the temperature is too "cold": you will make
the water comfortable very quickly with little trouble, by appropriately adjusting the temperature
control knob without knowing precisely the water temperature. Note that the water will be felt or
perceived "cold" over a range of temperature values and not only at a fixed temperature. The
human action is thus based on perception and not simply on a measured value. Fuzzy logic
systems emulate this human reasoning activity based on the concept of linguistic or "fuzzy"
variables. These variables are linguistic objects or words, rather than numbers. The measured
variable in a typical process are nouns, e.g. "temperature", "displacement", "velocity", "flow",
"pressure". The fuzzy variables themselves are adjectives that modify or linguistically quantify
the measured variable (e.g. "large positive" temperature-change, "small positive" temperature-
change, "zero" temperature-change, "small negative" temperature-change, and "large negative"
temperature-change). Normally, a minimum of three fuzzy variables "positive", "zero", and
"negative" (or "cold", "OK" and "hot" or "large", "OK" and "small") are used to linguistically
quantify a measured variable in three major perceived ranges. Additional ranges such as "very
large" and "very small" can also be added to extend the responsiveness of the system.
2.1.1 Why use FL?
FL offers a number of features that make it suitable for many problems and in particular control
problems.
It is inherently robust since it does not require precise, noise-free inputs and can be
programmed to fail safely if a feedback sensor quits or is destroyed. The fuzzy controller
output is a smooth function of inputs, despite a wide range of input variations.
It processes user-defined rules governing the target control system, so it can be readily
modified and tweaked to improve or alter system performance. New sensors can easily be
incorporated into the system simply by generating appropriate governing rules.
It is a rule-based procedure so it can accommodate any reasonable number on inputs and
outputs. However the rule-base quickly becomes complex if too many inputs and outputs are
chosen for a single implementation. It would be better to break the system into smaller
chunks and use several smaller distributed FL systems, each with more limited
responsibilities.
It can model and control non-linear systems that would be difficult or impossible to
model mathematically.

2.1.2 Chapter outline
......
2.2 Basics of Designing a Fuzzy Logic Model
Modelling based on data
Given the system characteristics described through historical/operational input-output data-sets, a
model can be obtained to approximate the system characteristics using an appropriate
approximation technique. However the selection of an approximation technique to model a
complex non-linear system is a difficult task. The models obtained by various approaches may
range from completely black box model to grey box to totally white-box models. The black-box
model parameters do not help provide much information about the system characteristics.
FL modelling partitions the state-space and embeds expert knowledge representing
partitions
In fuzzy logic approach to system modelling, the system state-space is partitioned into a finite
number of small regions or patches. Each of the regions is then represented by an IF-THEN type
rule. The approach thus allows explicit embedding of expert's knowledge in the form of IF-THEN
rules in a model representing the system characteristics. A special characteristics of the space
partitioning approach is that the boundaries of the partitioned regions are fuzzy in the sense that
there are some overlaps among regions. This means that at a particular time instant, the system
response is represented by more than one rule. This results in a very smooth model response
rather than an abrupt jump at the boundaries. As most of practical engineering systems display
smooth response, the fuzzy modelling approach has the capability to model any engineering
system quite well. In fact, it has been mathematically proved that a fuzzy system is a universal
approximator, as it can model any system to an arbitrarily high degree of accuracy.
A fuzzy logic controller is a prime example of a fuzzy system, which is a fuzzy model of the
actions of a human operator who is successful in appropriately controlling a target system. In
order to discuss the main elements of a fuzzy system, we first need to have answers for the
flowing questions, which are discussed in next sub-sections.
What is Fuzzy Logic?
How to Transfer Human Knowledge into the Model?
What are patches and how do they work?
2.3 Basics of Fuzzy Logic Theory
This section provides a brief introduction to basic definitions, notations and operations for fuzzy
sets. The section covers only those details that are essential for a realistic fuzzy system
development.
2.3.1 Crisp Sets and Fuzzy Sets
Classical sets are crisp sets. These sets or classes can be defined in several different ways in a
universe of discourse (or domain) U. The following methods are three typical representations.
1. By a list of elements:
S1 = {cow, deer, sheep, horse}.
S2 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
2. By definition of some property:
{ }
{ }
3
2
4
| 20
| 36
S x N x
S x R x
<
<
3. By a membership function (or a characteristic function):
1 if 1< 7
( )
0 otherwise
s
x
x
<

'

The above set can be graphically drawn as shown in the Figure 1.



x
1
1
7

Figure 1 Membership function of a crisp set.
Similar to the method 3, the fuzzy sets are normally represented using membership functions.
However for fuzzy sets, the membership function
( )
s
x
is the degree of belonging of some
element x to the universe of discourse X and can be any number
0 ( ) 1
s
x
. There are the
following two formal methods of defining fuzzy sets.
Method 1
If X is a collection of objects denoted by x, then a fuzzy set A in X is defined as a set of ordered
pairs:
{ } ( , ( )) |
A
A x x x X
where ,
( )
A
x
is called the membership function (MF) for the fuzzy set A. The MF maps each
element of X to a membership grade (or membership value) between 0 and 1. Note that the above
fuzzy set representation may also be written as, { } ( , ( )) :
A
x x x X
.
Example 1
Let us draw a membership function that represents the set of all people of medium height.
Suppose that the average height of a human being is 5.5 feet and let us interpret the "medium" as
"average". One possible representation is given in the Figure 2.
4 4.5 5 5.5 6 6.5 7
0
0.2
0.4
0.6
0.8
1
1.2
X = Height
M
e
m
b
e
r
s
h
i
p

G
r
a
d
e
s
medium
Figure 2 Membership function for people of medium height.
The above fuzzy membership function associated with "medium" height people maps the finite
universe of real numbers [4.0, 7.0] to a fuzzy set denoted as A1. This fuzzy set can be defined and
numerically written as,
A1 ={(x, A1(x))|x[4.0, 7.0]}
where, A1(x) is the triangular membership function defined as,
1
5.5
max(0,1 5.5
0.5
( )
5.5
max(0,1 5.5
0.5
A
x
if x
x
x
if x


+
' ;

'

+ >
' ;



A discretised version of the above fuzzy set can be written as,
A1 ={(x, A1(x))|x[4.0, 7.0]}
= {(4.00, 0), (4.25, 0), (4.50, 0), (4.75, 0), (5.00, 0), (5.25, 0.5),(5.50, 1.0),(5.75, 0.5),
(6.00, 0), (6.25, 0), (6.50, 0), (6.75, 0), (7.0, 0)}
Method 2
If X is a collection of objects denoted by x, then a fuzzy set A in X is defined as a set of ordered
pairs:
( ) / If is a collection of discrete objects.
( ) / If is a continuous space represented by a set real numbers R.
i
A i i
x X
A
X
x x X
A
x x X

' ;

Here, the summation and integration signs stand for the union of
( , ( ))
A
x x
pairs; these do not
indicate summation or integration in their usual sense. Similarly, "/" is only a marker and does not
imply division.
Example 2:
A discretised version of the fuzzy set in the Example 1 can be represented using the Method 2as
follows:
A1 ={ }
( ) /
i
A i i
x X
x x

= {(4.00/0)+(4.25/0)+(4.50/0)+(4.75/0)+(5.00/0)+(5.25/0.5)+(5.50/1.0)+(5.75/0.5)+
(6.00/0)+(6.25/0)+ (6.50/0)+(6.75/0)+(7.0/0)}
2.3.1 More on Fuzzy Membership Functions
A fuzzy membership function
( )
s
x
determines the degree of belonging of some element x to the
universe of discourse X. In fact any function
( ) [0,1] x
may describe a membership function
associated with some fuzzy set. These functions may have different shapes and the choice of a
particular shape is both subjective and problem dependent. The most common ones are
trapezoidal, triangular, Gaussian, and singleton shown in Figure 3

x
1
1
7

Figure 3 The most common fuzzy sets in engineering applications.
Two most widely used fuzzy membership functions triangular and trapezoidal are defined below
in their most general form.
Triangular membership functions:
0 if
if [ , ]
( )
if x [c,b]
0 if
x a
x a
x a c
c a
x
b x
b c
x b

<

'

>

Trapezoidal membership functions:


0 if
if [ , ]
( ) 1 if [ , ]
if x [n,b]
0 if
x a
x a
x a m
m a
x x m n
b x
b n
x b

<


'

>

where a and b denote lower and upper bounds, c is a centre of a triangle and m and n denote co-
ordinates of a tolerance as shown in Figure 3.
A fuzzy set is uniquely specified by its membership function. There are a set of standard
nomenclature used to define membership function more formally and precisely. These are defined
below.
Support:
The support of a fuzzy set A is the set of all points x in X such that
( ) 0
A
x
:
support (A)={ } | ( ) 0
A
x x
Core:
The core of a fuzzy set A is the set of all points x in X such that
( ) 1
A
x
:
core (A)={ } | ( ) 1
A
x x
Normality:
A fuzzy set A is normal if its core is nonempty. In other words, one can always find a point
x X at which
( ) 1
A
x
.
Crossover Points:
A crossover point of a fuzzy set A is a point x X such that
( ) 0.5
A
x
.
crossover (A)={ } | ( ) 0.5
A
x x
Fuzzy singleton:
A fuzzy set whose support is a single point in X with
( ) 1
A
x
is called a fuzzy singleton.

x
1
1
7

Figure 4 Core, supports, and crossover points of (a) the fuzzy set " middle aged" and (b) the fuzzy
singleton "45 years old".
The figure 4 (a) and (b) illustrate the core, support and crossover point of the bell-shape
membership function representing "middle aged" people and the singleton characterising "45
years old".
cut
and strong
cut
:
The
cut
or level set of a fuzzy set A is a crisp set defined by:
{ } | ( )
A
A x x


The strong
cut
or strong level set of a fuzzy set A is a crisp set defined by
support (A)={ } | ( )
A
x x >
The Height:
The height of a fuzzy set with membership function (x) is the highest value that (x) reaches
on the universe of discourse on which it is defined. A fuzzy set is said to be normal if its height
is equal to one.
Linguistic hedges:
A linguistic hedge is a modifier to a linguistic value such as very or more or less. When we
use linguistic hedges for linguistic values that already have membership functions, we can simply
modify these membership functions so that they represent the modified linguistic values.
Example 3
Define the following fuzzy sets which have linguistic hedges attached to the linguistic label small
defined below.
small = A4 ={z, A4(z)):z[0,120]}
={(0, 0), (20, 0.5), (40, 1), (60, 0.5), (80, 0), (100, 0), (120, 0)}
(1).very small
(2). more or less small
very small = {z, (A4(z))
2
):z[0,120]}
={(0, 0), (20, 0.25), (40, 1), (60, 0.25), (80, 0), (100, 0), (120, 0)}


z

40

80

1.

.5

very
small

120

Figure 5 Fuzzy set very small.
more or less small = {z, (A4(z))

):z[0,120]}
={(0, 0), (20, 0.71), (40, 1), (60, 0.71), (80, 0), (100, 0), (120, 0)}
z

1.

.5

more or less sma ll

40

80

120

Figure 6 Fuzzy set more or less small.
2.3.3 Basic Fuzzy Set Operations
Out of many set operations, the three most common and important operations are complement,
intersection, and union.
Fuzzy Complement:
(LOW or HIGH)
(LOW and HIGH)
Let us denote the complement ("not") of a fuzzy set S as S
c
. The membership function for the
complement of a fuzzy set S is defined as,
1
c
S
S

.
Therefore, the fuzzy set S
c
is defined over the universe of discourse X as,
{ } ( ,1 ( )) |
c
S
S x x x X
Fuzzy Intersection:
The intersection of fuzzy sets A and B defined over the universe of discourse X is a fuzzy set
denoted by A B , with membership function denoted by,
( ) ( ) ( )
A B A B
x x x


. Here the
operator

is a fuzzy intersection operator usually referred to as T-norm (triangular norm)


operator. The T-norm is defined by either of the following two methods:
Minimum operator: This computes the minimum of the membership values as in,
( ) ( ) ( ) ( ) min ( ), ( )
A B A B A B
x x x x x


Algebraic product operator: This computes the product of the membership values as in,
( ) ( ) ( ) ( ) ( )
A B A B A B
x x x x x


The fuzzy intersection set can then be defined as,
{( , ( )) : }
A B
A B x x x X


Fuzzy Union (OR):
The union of fuzzy sets A and B which are defined over the universe of discourse X, is a fuzzy
set denoted as A B , with membership function denoted by
( ) ( ) ( )
A B A B
x x x


. Here the
operator

is a fuzzy union operator usually referred to as T-norm (triangular conorm) operator.


The T-conorm is defined by either of the following methods:
Maximum operator: This computes the maximum of the membership values as in,
Error! Objects cannot be created from editing field codes.
Algebraic sum operator: This computes the algebraic sum of the membership values as in,
( ) ( )
A B A B A B A B
x x

+
The fuzzy set obtained through union operation can then be defined as,
{( , ( )) : }
A B
A B x x x X


Example 4
(a). Consider two continuous finite fuzzy sets of x defined by two linguistic qualifiers LOW and
HIGH on the finite universe of discourse [0, 60] representing a temperature range. The fuzzy sets
are written below in a discretised form.
LOW = A1 ={(x, A1(x)):x[0, 60]}
={(0, 0), (10, 0.5), (20, 1), (30, 0.5), (40, 0), (50, 0), (60, 0)}
HIGH = A2 ={(x, A2(x)):x[0, 60]}
={(0, 0), (10, 0), (20, 0), (30, 0.5), (40, 1), (50, 0.5), (60, 0)}
Represent numerically and graphically the following fuzzy sets. Use minimum to represent T-
norm and maximum to represent T-conorm.
(1). LOW and HIGH
(2). LOW or HIGH
(3). not HIGH
(LOW or HIGH)
(LOW and HIGH)
(4). not (LOW or HIGH)
Solution:
LOW and HIGH= {(x, min(A1(x), A2(x)):x[0, 60]}
={(0, 0), (10, 0), (20, 0), (30, 0.5), (40, 0), (50, 0), (60, 0)}
LOW or HIGH= {(x, max(A1(x), A2(x)):x[0, 60]}
={(0, 0), (10, 0.5), (20, 1), (30, 0.5), (40, 1), (50, 0.5), (60, 0)}
not(HIGH) = {(x, 1-A2(x)):x[0, 60]}
={(0, 1), (10, 1), (20, 1), (30, 0.5), (40, 0), (50, 0.5), (60, 1)}
not(LOW or HIGH)
={(0, 1), (10, 0.5), (20, 0), (30, 0.5), (40, 0), (50, 0.5), (60, 1)}
2.4.3 Fuzzy Cartesian Product (Fuzzy Relation)
The intersection and union operations are both defined for fuzzy sets that lie on the same universe
of discourse. The fuzzy cartesian product is used to quantify operations on many universes of
discourse.
The cartesian product of two crisp sets X and Y, denoted by XY, is the crisp set of all ordered
pairs such that the first element in each pair is a member of X and the second element is a
member of Y:
XY = {(x, y)|x X and y Y}
.
Let X={1, 2} and Y={a, b, c} be two crisp sets. The cartesian product is given as,
XY = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}
1.0
20 40
0.5
x,
0
C
60
not (HIGH)
20 40
x,
0
C
1.0
0.5
60
(LOW or HIGH)
x,
0
C
20 40
60
1.0
0.5
(LOW and HIGH)
The fuzzy cartesian product is an extension of the above cartesian product defined for crisp sets.
If A1 and A2 are fuzzy sets defined on the universes of discourse X1 and X2 respectively, their
cartesian product is a fuzzy set (also called "fuzzy relation"), denoted by A1A2 with a
membership function defined by,
1 2 1 2
1 2 1 2
( , ) ( ) ( )
A A A A
x x x x


Thus, the focus in fuzzy cartesian product is on relation between two sets, known as a binary
relation and denoted by R(X1, X2 ) or simply R. The binary relation R is defined over a Cartesian
product X1 X2. If the elements of the product set come from a discrete universe of discourse, the
relation R can be represented by a relational matrix or graphically as a discrete set of points in a
three dimensional space .
A cartesian product can be generalised for n sets, in which case, elements of the cartesian product
are n-tuples (x1, x2, .., xn). Similar to the case of two sets, the membership function for a
cartesian product of n sets can be defined as,
1 2 1 2
1 2 1 2
( , , ) ( ) ( ) ( )
n n
A A A n A A A n
x x x x x x


K
K K
Example 5
A complete fuzzy relation (or Cartesian Product) representation can be illustrated by the following
example. Let us draw a membership function that quantifies the statement "the number x is near 10
and the number y is near 2". A Possible scenario is drawn in Figure 7 - Figure 9. The membership
function for the statement "the number x is near 10" is plotted in Figure 7 based on the membership
grades listed in the Table 1(a). Similarly the membership function for the statement "the number y is
near 2" is drawn in the Figure 8 based on the entries in Table 1(b). The fuzzy relationship matrix
representing the membership grades for the statement "the number x is near 10 and the number y is
near 2" is listed in the Table 1(c) and is graphically shown in the Figure 9.
7 8 9 10 11 12 13
0
0.2
0.4
0.6
0.8
1
1.2
x
M
e
m
b
e
r
s
h
ip
G
r
a
d
e
s
Figure 7 Membership function for statement
the number x is near 10
0 0.5 1 1.5 2 2.5 3 3.5 4
0
0.2
0.4
0.6
0.8
1
1.2
y
M
e
m
b
e
r
s
h
ip
G
r
a
d
e
s
Figure 8 Membership function for statement
the number y is near 2.
7
8
9
10
11
12
13
0
1
2
3
4
0
0.2
0.4
0.6
0.8
1
x
y
c
e
r
t
a
in
t
y
Figure 9 Membership function for
uantifying numbers near 10 and near 2
Table 1 Membership for the statement the
number x is near 10
x
(x)
7.0 0
7.5 0
8.0 0
8.5 0.5
9.0 1.0
9.5 1.0
10.0 1.0
10.5 1.0
11.0 1.0
11.5 0.5
12.0 0
12.5 0
13.0 0
A1 ={(x, A1(x)):x[7.0, 13.0]}
where, A1(x) is a trapezoidal membership
function defined as,
A1(x) = trapezoid(x, 8.0, 9.0, 11.0, 12.0)
A discretised version of the above fuzzy set
can be written as,
A1 ={ (7.0,0), (7.5, 0), (8.0, 0), (8.5, 0.5),
(9.0, 1.0), (9.5, 1.0), (10.0, 1.0), (10.5,1.0),
(11.0, 1.0), (11.5, 0.5), (12.0, 0), (12.5, 0),
(13.0, 0)}
Table 2 Membership for the statement the
number y is near 2
y
(y)
0 0
0.5 0
1.0 0.5
1.5 1.0
2.0 1.0
2.5 1.0
3.0 0
3.5 0
4.0 0
A2 ={(y, A2(y)):y[0, 4.0]}
where, A1(x) is a trapezoidal membership
function defined as,
A1(x) = trapezoid(x, 0.5, 1.5, 2.5, 3.0)
A discretised version of the above fuzzy set
can be written as,
A2={ (0,0), (0.5, 0), (1.0, 0.5), (1.5, 1.0),
(2.0, 1.0), (2.5, 1.0), (3.0, 0), (3.5, 0), (4.0, 0
max(0,1 )
( , , , , ) 1
max(0,1 )
x a
if a x b
b a
trapezoid x a b c d if b x c
d x
if c x d
d c

+
' ;


'

+
' ;

Table 3 The relationship matrix for the certainty or membership grade quantifying numbers near
10 and near 2.
Discretised A1 A2(x,y)
x/y 0 .5 1 1.5 2 2.5 3 3.5 4
7 0 0 0 0 0 0 0 0 0
7.5 0 0 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0 0 0
8.5 0 0 0.5 0.5 0.5 0.5 0 0 0
9 0 0 0.5 1.0 1.0 1.0 0 0 0
9.5 0 0 0.5 1.0 1.0 1.0 0 0 0
10 0 0 0.5 1.0 1.0 1.0 0 0 0
10.5 0 0 0.5 1.0 1.0 1.0 0 0 0
11 0 0 0.5 1.0 1.0 1.0 0 0 0
11.5 0 0 0.5 0.5 0.5 0.5 0 0 0
12 0 0 0 0 0 0 0 0 0
12.5 0 0 0 0 0 0 0 0 0
13 0 0 0 0 0 0 0 0 0
A1 A2(x,y) = A1(x) * A2(y)
A1 A2 ={(x,y, A1 A2(x,y):x[7.0, 13.0], y[0, 4.0]}
2.4.4 Fuzzy If-Then Rules
A fuzzy if-then rule (also known as fuzzy rule, fuzzy implication, or fuzzy conditional statement)
assumes the form,
if x is A then y is B
where A and B are linguistic values defined by fuzzy sets on universes of discourse X and Y,
respectively. Often "x is A" is called the antecedent or premise, while "y is B" is called the
consequence or conclusion. Some very common examples are:
If pressure is high, then volume is small.
If road is slippery, then driving is dangerous.
If tomato is red, then it is ripe.
If the speed is high, then apply the brake a little.
In essence, the fuzzy rule expression "if x is A then y is B" describes a relation between two
variables x and y. This would therefore require a binary fuzzy relation R to be defined on the
product space XY. One way this can be interpreted as A B to mean that A is coupled with B,
then
(( , ), ( ) ( ))
A A
X Y
R A B A B x y x x

where * is a T-norm operator and A B represents fuzzy relation R.


2.3.5 Fuzzy Reasoning
Fuzzy reasoning, also known as approximate reasoning, is an inference procedure that derives
conclusions from a set of fuzzy if-then rules and known facts. The Zadeh's compositional rule of
inference is the basic concept, based on which a fuzzy inference procedure is derived.
2.3.5.1 Compositional Rule of Inference
The compositional rule of inference proposed by Zadeh (1973) is a generalisation of the
following familiar notion. Suppose that we have a curve y = f(x) that regulates the relation
between x and y. When we are given x = a, then we can infer that y = b = f(a); see Figure 10(a).
A generalisation of this process would allow a to be an interval and f(x) to be an interval valued
function, Figure 10(b). To find the resulting interval y = b corresponding to the interval x = a, let
us construct a cylindrical extension of a and then find its intersection I with interval-valued curve.
The projection of I onto the y axis yields the interval y = b corresponding to the interval x = a, we
first construct a cylindrical extension of a and then find its intersection I with the interval valued
curve. The projection of I onto y-axis yields the interval y = b.
Now let us assume that F is a fuzzy relation on X Y and A is a fuzzy set of X, a shown in Figure
11 (a) and Figure 11 (b). To find the resulting fuzzy set B, again we construct a cylindrical c(A)
with base A. The intersection of c(A) and F (Figure 11 (c)) forms the analog of the region of
intersection I in Figure 10(b). By projecting
( ) c A F
onto the y-axis, we infer y as a fuzzy set B
on the y-axis, as shown in Figure 11 (d). This can be mathematical described in the following
way:
Let
, ( ),
A c B
A
and
F

be the MFs of A, c(A), B, and F respectively, where


( )
c
A
is related to
A

through, ( )
( , ) ( )
c A A
x y x
.
Then ,
[ ]
( ) ( )
( , ) min ( , ), ( , )
min ( , ), ( , )
c c F A F A
A F
x y x y x y
x y x y

1
]

By projecting
( ) c A F
onto the y-axis, we have,
[ ]
[ ]
( ) max min ( ), ( , )
( ) ( , )
B x A F
x A F
y x x y
x x y


This is basically the max-min composition of two relation matrices if both A (a unary fuzzy
relation) and F (a binary fuzzy relation) have finite universes of discourse. Conventionally, B is
represented,
B A F o
where,
o
denotes the composition operator.
Figure 10 Derivation of y = b.....
Figure 11 Compositional rule of inference.
2.3.5.2 Inference Procedure under Fuzzy Reasoning
The basic rule of inference in traditional two-valued logic is modus ponens, according to which
we can infer the truth of a proposition B from the truth of A and the implication A B .
For instance, if A is identified with "the tomato is red" and B with "the tomato is ripe", then if it
is true that "the tomato is red", it is also true that "the tomato is ripe". This can formally be
written as,
premise 1 (fact): x is A,
premise 2 (rule): if x is A then y is B
consequence (conclusion): y is B.
As part of a fuzzy reasoning system, fuzzy rules describe the behaviour of a realistic physical
system. The fuzzy rules should therefore conform to the requirement that if there is no cause,
there will be no effect. Stating differently, for fuzzy implication, the truth value of the conclusion
must not be larger than that of the premise.
Moreover, in much of human reasoning, modus ponens is employed in an approximate manner.
For example, if we have the same implication rule "if tomato is red , then it is ripe" and we know
that "the tomato is more or less red" then we may infer that "the tomato is more or less ripe". This
can be formally written as,
premise 1 (fact): x is A',
premise 2 (rule): if x is A then y is B
consequence (conclusion): y is B'
where A' is close to A and B' is close to B. When A, B, A' and B' are fuzzy sets of appropriate
universes, this inference procedure is called approximate reasoning or fuzzy reasoning; it is also
called generalied modus ponens, since it has modus ponens as a special case.
Using the compositional rule of inference discussed in the previous subsection, let us
mathematically formulate the above inference procedure. Let A, and A' be fuzzy sets of X and B
and B' be fuzzy sets of Y. Assume that the fuzzy implication A B is expressed as a fuzzy
relation R on XY. Then the fuzzy set B' induced by "x is A' " and the fuzzy rule "if x is A then y
is B" is defined by,
[ ]
[ ]
' '
'
( ) max min ( ), ( , )
( ) ( , )
, ,
' ' ' ( )
B x A R
x A R
y x x y
x x y
or equivalently
B A R A A B


o o
This inference procedure can thus be used to derive conclusions in any fuzzy reasoning system
provided that the fuzzy implication
( ) A B
is defined as an appropriate binary relation. Let us
now discuss the computational aspects of this fuzzy inference procedure and extend the
discussion to situations in which multiple fuzzy rules with multiple antecedents are involved in
describing a fuzzy system.
Example 6
Suppose there is a finite fuzzy set of y defined by a linguistic qualifier LOW on the finite
universe of discourse [0, 120] representing furnace fuel firing rate in percentage. The fuzzy set is
written below in a discretised form.
LOW = A3 ={(y, A3(y)):y[0,120]}
={(0, 0), (20, 0.5), (40, 1), (60, 0.5), (80, 0), (100, 0), (120, 0)}
Consider the fuzzy rule:
If (x is HIGH) then (y is LOW).
Here the fuzzy set HIGH is defined in the Example 4. Find the fuzzy relational matrix R
representing the fuzzy implication (LOWHIGH) of this rule using the minimum operator to
represent T-norm.
Also determine the implied or induced consequent fuzzy set for the following input:
x = 30
0
C
Solution:
HIGH = A2 ={(x, A2(x)):x[0, 60]}
={(0, 0), (10, 0), (20, 0), (30, 0.5), (40, 1), (50, 0.5), (60, 0)}
LOW = A3 ={(y, A3(y)):y[0,120]}
={(0, 0), (20, 0.5), (40, 1), (60, 0.5), (80, 0), (100, 0), (120, 0)}
2 3
( , ) ( ) ( )
R A A
x y x y
The relational matrix (R) =
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0.5 0.5 0.5 0 0 0
0 0.5 1 0.5 0 0 0
0 0.5 0.5 0.5 0 0 0
0 0 0 0 0 0 0
The given input can be written as a fuzzy singleton A3' with a discrete representation of membership
function
2
'
( )
A
x
= [0 0 0 1 0 0 0].
Applying the compositional rule of inference,
3 2
2
' '
'
( ) ( ) ( , )
max min ( ), ( , )
A x A R
x A R
y x x y
x x y


1
]
1
]
=
[ ]
3
3
'
'
[max(0, 0, 0, 0, 0, 0, 0), max(0, 0, 0,.5, 0, 0, 0), max(0, 0, 0,.5, 0, 0, 0), max(0, 0, 0,.5, 0, 0, 0),
max(0, 0, 0, 0, 0, 0, 0), max(0, 0, 0, 0, 0, 0, 0), max(0, 0, 0, 0, 0, 0, 0)]
0 .5 .5 .5 0 0 0
A
A

Single Rule with Single Antecedent:


This simple case is the same as the fuzzy rule "if x is A then y is B". The formula in (2.21) is
therefore applicable. However, a further simplification can provide,
[ ]
' '
'
'
( ) [ ( ) ( , )]
( ) ( ( ) ( ))
[ ( ) ( )] ( )
( )
B x A R
x A A B
x A A B
B
y x x y
x x y
x x y
w y






This means that the degree of match w as the maximum of
'
[ ( ) ( )]
A A
x x
is to be found first.
This is shown as the shaded area in Figure 12. The MF of the resulting B' is equal to the MF of B
clipped by w, shown as shaded area in Figure 12. Intuitively, w represents a measure of degree of
belief for the antecedent part of a rule; this measure gets propagated by the if-then rules and the
resulting degree of belief or MF for the consequent part B' in Figure 12 should be no greater than
w.
z

1.

.5

more or less sma ll

40

80

120

Figure 12 Graphic interpretation of generalised modus ponens (GMP) using the max-min
composition
Single Rule with Multiple Antecedents:
A fuzzy if-then rule with two antecedents is usually written as "if x is A and y is B then z is C".
This can formally be written as,

premise 1 (fact): x is A' and y is B',
premise 2 (rule): if x is A and y is B then z is C,
consequence (conclusion): z is C'.
The fuzzy rule in premise 2 can be put into the simpler form " A B C ". Intuitively, this fuzzy
rule can be transformed into a ternary fuzzy relation Rm as follows:
Rm(A, B, C) =
( ) A B C (( , , ), ( ) ( ) ( ))
A B C
X Y Z
x y z x x x

The resulting consequent fuzzy set is then expressed as,


' ( ' ') ( ) C A B A B C o
.
Thus,
' , ' '
, ' '
, ' '
' '
1 2
( ) [ ( ) ( ) ( , , )]
[( ( ) ( )) ( ( ) ( ) ( )]
[( ( ) ( )) (( ( ) ( )) ( )]
( ( ) ( )) (( ( ) ( )) ( )
( ) ( )
m
C x y A B R
x y A B A B C
x y A B A B C
x A A y B B C
C
z x x x y z
x x y y z
x x y y z
x x y y z
w w z









where w1 and w2 are the maxima of MFs of ' A A and ' B B , respectively. In general, w1
denotes the degree of compatibility between A and A'; similarly for w2. Since the antecedent part
of the fuzzy rule is constructed by the connective "and",
1 2
w w
is called firing strength or degree
of fulfillment of the fuzzy rule, which represents the degree to which the antecedent part of the
rule is satisfied. A graphic interpretation is shown in Figure 13, where the MF of the resulting C'
is equal to the MF of C clipped by the firing strength w =
1 2
w w
.
z

1.

.5

more or less sma ll

40

80

120

Figure 13 Approximate reasoning for multiple antecedents.
Multiple Rules with Multiple Antecedents:
The interpretation of multiple rules is usually taken as the union of fuzzy relations corresponding
to the fuzzy rules. Therefore for a GMP problem written as,
premise 1 (fact): x is A' and y is B',
premise 2 (rule 1): if x is A1 and y is B1 then z is C1,
premise 2 (rule 2): if x is A2 and y is B2 then z is C2,
consequence (conclusion): z is C'.
One can employ the fuzzy reasoning shown in Figure 14 as an inference procedure to derive the
resulting output fuzzy set C'.
To verify this inference procedure, let
1 1 1 1
R A B C
and
2 2 2 2
R A B C
. Since the max-min
composition operator
o
is distributive over the operator

, it follows that
1 2
1 2
' '
1 2
' ( ' ') ( )
[( ' ') ] [( ' ') ]
C A B R R
A B R A B R
C C



o
o o
where
'
1
C and
'
2
C are the inferred fuzzy sets for rules 1 and 2, respectively. Figure 14 shows
graphically the operation of fuzzy reasoning for multiple rules with multiple antecedents.
When a given fuzzy rule assumes the form "if x is A or y is B then z is C", then firing strength is
given as the maximum of antecedent part of a given condition. This fuzzy rule is equivalent to the
union of the two fuzzy rules "if x is A then z is C" and "if y is B then z is C".
z

1.

.5

more or less sma ll

40

80

120

Figure 14 Fuzzy reasoning for multiple rules with multiple antecedents.
In summary, the process of fuzzy reasoning or approximate reasoning can be divided into four
steps:
1. Degrees of Compatibility: Compare the known facts with the antecedents of fuzzy rules to
find the degrees of compatibility with respect to each antecedent MF.
2. Firing Strength: Combine degrees of compatibility with respect to antecedent MFs in a rule
using fuzzy AND or OR operators to form a firing strength that indicates the degree to which
the antecdent part of the rule is satisfied.
3. Qualified (implied or induced) consequent MFs: Apply the firing strength to the consequent
MF of a rule to generate a qualified or implied consequent MF. (The implied consequent MFs
represent how the firing strength gets propagated and used in a fuzzy implication statement.)
4. Overall output MF: Aggregate all the qualified or implied consequent MFs to obtain an
overall output MF.

2.3.6 Fuzzy Inference Systems
The fuzzy inference system (FIS) is based on the concept of fuzzy set theory, fuzzy if-then rules,
and fuzzy reasoning. Depending upon the area of application, the FIS is known by various names
such as fuzzy-rule-based system, fuzzy expert system, fuzzy associative memory, fuzzy logic
controller or simply fuzzy system.
There are three types of FIS that have been widely employed in various applications. These are
Mamdani FIS, Sugeno FIS, and Tsukamto FIS named after their inventors. The differences lie in
their consequents of fuzzy rules and thus their aggregation and defuzzification procedures differ
accordingly. Our discussion will be limited to two most popular ones, Mamdani and Sugeno
fuzzy systems.
z

1.

.5

more or less sma ll

40

80

120

Figure 15 Block diagram of a fuzzy inference system.
2.3.6.1 Mamdani Fuzzy Models
The Mamdani FIS was proposed by Mamdani and Assilian (1975) as the first attempt to control a
steam engine and boiler combination by a set of linguistic control rules obtained from
experienced human operators. Figure 16 is an illustration of how a two rules Mamdani FIS
derives the overall output z' when subjected to two crisp inputs x' and y'. This is derived from the
fuzzy reasoning principle for "multiple rules and multiple antecedents" discussed earlier.
The FIS shown in Figure 16 has two rules:
If x is A1 and y is B1 Then z is C1.
If x is A2 and y is B2 Then z is C2.
The two crisp values x' and y' of the two antecedents (or inputs) x and y are fuzzified into two fuzzy
singletons A' and B' with membership functions
'
A

and '
B

centered at x' and y' respectively.


Let us denote the degree of compatibility of these fuzzy singletons with the antecedent MFs
1
A

and
1
B

of
rule 1 as
1
A
w
and
1
B
w
which can be computed as,
'
1 1 1
'
1 1 1
'
'
( ( ) ( )) ( )
( ( ) ( )) ( )
A x A A
A
B y B B
B
w x x x
w y y y




The firing strength for rule 1 can then be computed as,
1 1 1 1
,1 1
( ') ( ')
firinng A B A B
w w w x y
Similarly, the firing strength for rule 2 can be computed as,
2 2 2 2
,2 2
( ') ( ')
firinng A B A B
w w w x y
Here, the T-norm (AND operator)

can either be implemented as a min operator or an algebraic


product. The rule firing strength is sometimes also called premise membership grade or the rule
validity index at the given crisp inputs.
The membership grade for implied consequent fuzzy sets can then be computed as,
1
2
,1 1
,2 2
( ) ( ( ))
( ) ( ( ))
implication C
implication C
z w z
z w z




Here again, the T-norm (AND operator)

can either be implemented as a min operator or an


algebraic product.
The membership grade for the overall implied fuzzy set can then be computed as,
_ ,1 ,2
( ) ( ) ( )
overall implication implication implication
z z z K
As per the Max-min fuzzy inference composition rule, the T-conorm (OR operator)

is
implemented as a max operator. However for computational efficiency, a widely used method is
Sum-min fuzzy inference composition. In this, the T-conorm is implemented as a direct
summation of implied consequent fuzzy membership grades.
There are several defuzzification methods available in fuzzy logic literature for computing the
crisp output of a fuzzy system. Two of the popular methods are discussed here. These are Centre
of Area (COA) method and Centre-average (CA) method. For the details of other methods, refer
[Jang et al. 1997 and Yager and Filev, 1993].
Using Max-min form of fuzzy inference composition rule, the crisp value in COA method is
computed as,
_
_
_
_
( )
( )
In discrete form,
( )
( )
overall implication
Z
COA
overall implication
Z
i overall implication i
Z
COA
overall implication i
Z
z z dz
z
z dz
z z
z
z

In sum-min form of inference computation, the contribution from each of the active fuzzy rules
can independently be added together. If Nr rules are fired, there will be Nr implied consequent
fuzzy sets contributing to COA computation as,
( )
( )
( )
( )
,
1
,
1
,
1
,
1
( )
( )
In discrete form,
( )
( )
R
R
R
R
N
implication j
Z
j
COA N
implication j
Z
j
N
i implication j i
Z
j
COA N
implication j i
Z
j
z z dz
z
z dz
z z
z
z

If it is straightforward to determine the area and the centroid of each of the blocks under implied
consequent fuzzy membership functions, the crisp value can easily computed using moment of
area approach in sum-min form of inference computation as,
( )
( )
1
1
R
R
N
j j
j
COA N
j
j
z area
z
area

where, zj and areaj are centroid and area of the block under the consequent fuzzy membership
function implied by rule j.
In Figure 16, the firing strength and membership grade for implied fuzzy set are computed using
min operator. It is also shown that the defuzzification can be done using either of the Max-min
and Sum-min approaches.
As the T-norm can be implemented using product operator as well, both the firing strengths and
membership grade for implied fuzzy sets can be computed using product operator in a Mamdani
fuzzy inference system. This is shown in Figure 17.

A
1

A
2

B
1

B
2






C
1

C
2

Z
Y X
w
1

w
2

max
sum
X
Y
x y
Z
min
C C
C
1

C
2

Z
Z


z
COA

z
COA

Figure 16 Mamdani FIS using min for T-norm operator and max and sum for T-conorm operator.

A
1

A
2

B
1

B
2






C
1

C
2

Z Y X
w
1

w
2

max
sum
X Y
x y
Z
product
ct
C C
C
1

C
2

Z
Z


z
COA

z
COA

Figure 17 Mamdani FIS using product for T-norm operator and max and sum for T-conorm operator.
As clearly seen above, the COA method of defuzzification involves complex computations
which may make a fuzzy system inappropriate for real-time operation. The Centre-average (CA)
method is computationally much simpler. In CA method, the crisp output is computed as the
weighted average of centres of consequent fuzzy memberships corresponding to active rules. The
centres are weighted by the firing strengths of the corresponding rules. Mathematically, it is
defined as,

, , , ,
1 1
, ,
1 1
R R
R R
N N
c i firing j c i premise j
j j
CA N N
firing j premise j
j j
z z
z







where, , c i
z
is the centre of consequent membership function corresponding to rule j.
2.3.6.2 Sugeno Fuzzy Models
The Sugeno fuzzy model (also known as TSK fuzzy model or functional fuzzy model) was
proposed by Takagi, Sugeno, and Kang [Sugeno and Kang, 1988; Takagi and Sugeno, 1985] in
an effort to develop a systematic approach to generating fuzzy rules from a given input-output
data set. A typical fuzzy rule in a Sugeno fuzzy model has the form,
if x is A and y is B then z = f(x, y),
where A and B are fuzzy sets in the antecedent, while z = f(x, y) is a crisp function in the
consequent. Usually f(x, y) is a polynomial in the input variables x and y, but it can be any
function as long as it can appropriately describe the output of the model within the fuzzy region
specified by the antecedent of the rule.
When f(x, y) is a first order polynomial, the resulting fuzzy inference system is called a first order
Sugeno model which was originally proposed in [Sugeno and Kang, 1988; Takagi and Sugeno,
1985]. When f(x, y) is a constant, the resulting fuzzy inference system is then called a zero-order
Sugeno model. This can be viewed as a special case of Mamdani fuzzy inference system, in
which each rule's consequent is specified by fuzzy singleton (or a pre-defuzzified consequent).
Moreover, a zero-order sugeno fuzzy model is functionally equivalent to a radial basis function
network under certain minor constraint [Jang and Sun, 1993].
The output of a zero-order Sugeno fuzzy model is a smooth function of its input variables as long
as the neighbouring MFs in the antecedent have enough overlap. In other words, the overlap of
MFs in the consequent of a Mamdani model does not have a decisive effect on the smoothness; it
is the overlap of the antecedent MFs that determines the smoothness of the resulting input-output
behaviour.
Figure 18 shows the fuzzy reasoning procedure for a first order Sugeno fuzzy model for a system
described by the following two fuzzy rules.
Rule 1: if x is A1 and y is B1 then z = z1 = p1 x1 + q1 y1 + r1
Rule 2: if x is A2 and y2 is B2 then z = z2 = p2 x2 + q2 y2 + r2
The inference procedure is shown for the following crisp values of the two inputs.
x = x'
y = y'
As in case of Mamdani FIS, the two crisp values x' and y' of the two antecedents (or inputs) x and
y are fuzzified into two fuzzy singletons A' and B' with membership functions
'
A

and '
B

centered at x' and y' respectively.


Let us denote the degree of compatibility of these fuzzy singletons with the antecedent MFs
1
A


and
1
B

of rule 1 as
1
A
w
and
1
B
w
which can be computed as,
'
1 1 1
'
1 1 1
'
'
( ( ) ( )) ( )
( ( ) ( )) ( )
A x A A
A
B y B B
B
w x x x
w y y y




The rule firing strengths can then be computed as,
1 1
2 2
,1 1
, 2 2
( ') ( ')
( ') ( ')
firinng A B
firinng A B
w x y
w x y





As usual, the AND operator

can either be implemented as a min operator or an algebraic


product.
Since each rule has a crisp output, the overall output is obtained by adding together the crisp
outputs in proportion to the firing strengths of corresponding rules. Thus the overall crisp output
is a weighted average.
1 1 2 2
1 2
w z w z
z
w w
+

+
This avoids the time consuming process of COA method of defuzzification required in a
Mamdani model.
Min or
Product



y
y x x
x
w
1

w
2

z
2
= p
2
x + q
2
y + r
2


1 1 2 2
1 2
w z w z
z
w w
+

+

z
1
= p
1
x + q
1
y + r
1

Figure 18 The Sugeno Fuzzy Model.
2.3.6.3 Fuzzy Modelling
A fuzzy system is designed to model a target system based on its past known behaviour. The
fuzzy model is then expected to be able to reproduce the behaviour of the target system. For
instance, if the target system is a human operator in-charge of controlling a chemical reaction
process, the fuzzy system then becomes a fuzzy logic controller that can control the process.
Similarly, if the target system is a medical doctor, the fuzzy system then becomes a fuzzy expert
system for medical diagnosis.
In general, a standard fuzzy modelling process has the following features:
The rule structure of a fuzzy system makes it easy to incorporate human expertise about
the target system directly into the modelling process. Particularly, the fuzzy modelling
takes advantage of domain knowledge that might not be easily or directly employed in
other modelling approaches.
When the input-output data of a target system is available, conventional system
identification techniques can be used for fuzzy modelling.
Conceptually, fuzzy modelling may be pursued in two stages, which are not totally disjoint. The
first stage is the identification of the surface structure, which includes the following tasks:
1. Select relevant input and output variables.
2. Choose a specific type of fuzzy inference system.
3. Determine the number of linguistic terms associated with each input and output variables. For
a Sugeno system, it may involve determining the order of the consequent equation.
4. Design a collection of fuzzy if-then rules.
To accomplish the above tasks, one relies on ones own knowledge (common sense, simple
physical laws, and so on) of the target system, information provided by human experts who are
familiar with target system (which could be human expert themselves), or simply trial and error.
After the first stage of fuzzy modelling, we obtain a rule-base that can more or less describe the
behaviour of the target system by means of linguistic terms. The meaning of these linguistic
terms is determined in the second stage, the identification of deep structure, which determines the
MFs of each linguistic term ( and the coefficients of each rule's output polynomial if a Sugeno
model is used). Specifically, the identification of deep structure includes the following tasks:
1. Choose an appropriate family of parameterised MFs.
2. Interview human experts familiar with the target systems to determine the parameters of the
MFs used in the rule-base.
3. Refine the parameters of the MFs using regression and optimisation techniques.
Tasks 1 and 2 assume the availability of human experts, while the task 3 assumes the availability
of a desired input-output data set. When a fuzzy system is used as a controller for a given plant,
the objective in task 3 changes to that of searching for parameters that will provide the best plant
performance.
2.3.7 Application of Fuzzy Logic
A fuzzy logic controller (or fuzzy controller) is one of the very popular applications of fuzzy
logic. This section discusses the design of fuzzy controllers for a number of real-world control
problems.
2.3.7.1 A Fuzzy controller for water level control in a tank
A cylindrical tank has an opening near the top end through which water flows in. The rate of
water inflow is manipulated by a valve. There is another opening at the bottom through which
water continuously flows out in an output pipe. The outflow rate is obviously determined by the
level of the water in the tank. The water level dynamics in the tank can thus be expressed by the
following differential equation.
2 ( ) ( ) ( ) c gh t dh t u t
dt A A

+
where, h(t) is the water level in the tank, c is the cross-section area of the output pipe, g = 9.8 m/s
2
is gravitational acceleration, A is cross section area or the bottom area of the tank, and u(t) is the
input flow.
The water level in the tank can vary in the range 0 2 m. The valve position can be assumed to
vary between fully open and fully close positions represented by 0 1. In the fully open position,
the rate of water inflow can be 0.5 m
3
/s. The rate of change in the water level varies in the range
0.1 to +0.1 m/s.
Let r(t) be the reference signal setting the desired water level in the tank. It is required to design a
fuzzy logic controller to maintain the water level at the desired level set by the reference signal
r(t).
Fig. x.1 Water tank
I. Analysis:
Stage 1: Identification of the surface structure
Choosing FLC inputs and outputs
Choose a specific type of fuzzy inference system
Putting control knowledge into rule-bases
o Linguistic descriptions
o Rules
o Rule-bases
Stage 2: Identification of deep structure
Interview human experts familiar with the target systems to determine the parameters of the
MFs used in the rule-base.
Fuzzy quantification of knowledge
o Membership functions
o Fuzzification
Matching: Determining which rules to use
o Premise quantification via fuzzy logic
o Determining which rules are on
Inference Step: Determining conclusions
o Recommendation from one rule
o Recommendation from another rule
Converting Decisions into actions
o Combining recommendations
o Other ways of combining
Graphical depiction of fuzzy decision-making
Visualising the FLC's dynamical operation
FLC tuning.
FLC inputs and outputs:
The inputs to the system (i.e. the water tank) are input flow u(t) which is varied through a valve.
The output of the system is water level in the tank h(t). The rate of change in the water level
( ) dh t
dt
may also be monitored and can be considered another output variable. Thus, the water tank
level and the rate of change in water level may be two inputs to the controller, and the valve
opening can act as an output from the fuzzy controller.
In order to design a fuzzy controller, let us see how a human being will apply an appropriate
control action so that the water level reaches the desired reference point at a faster speed and the
oscillatory changes in the water level are avoided. Clearly, this is a very simple system to control
by appropriately initiating the control action for opening the inlet valve, while keeping an eye on
the actual water level with reference to the set desired reference point. If relative to reference
point, the water level is low then inlet valve would need to be opened further. Conversely, if
relative to the reference point, the water level is high then inlet valve would need to be closed. If
the water level is at or very close to the reference point, there is no need to make any change in
the inlet valve. However, a human being controlling the tank level would also be careful about
the rate at which the level is changing. If the level is rising at a fast rate, even if the current water
level is close to reference point, he/she will try to slowly close the inlet valve, so that water level
stops rising. Conversely, if the level is falling at a fast rate, he/she will try to slowly open the inlet
valve, so that water level stops falling.

Fig. x.2 A closed-loop controller with human-in-loop.
Let us now embed the above control strategy in a fuzzy logic controller. The first task is to
precisely define the input(s) and output(s) of the desired fuzzy control system. Let r(t) be the
reference signal setting the desired water level in the tank. It is then required to design a fuzzy
logic controller to maintain the water level at the desired level set by the reference signal r(t).
Thus the inputs to the controller are:
level-error relative to the desired reference point, e(t) = r(t) h(t)
level change-rate
( ) dh t
dt
.
The output from the controller is valve opening u(t).
A negative valve opening signal would start closing the inlet valve, while a positive signal would
start opening the valve. Intuitively, the following assumptions can be made regarding universes of
discourse of the inputs and output variables. The level-error relative to desired level r(t) can vary
in the range 1 to +1 m. The rate of change in the water level can vary in the range 0.1 to +0.1
m/s. The valve opening signal to the inlet valve can vary in the range 1 to +1.
Let us now divide the universe of discourse for level-error, [-1, 1] in to three fuzzy sets negative,
zero, and positive. Here the fuzzy term negative is assumed to give a perception that the level
error (r(t) h(t)) is closer to 1, which means that the level h(t) is "high relative to the desired
level r(t)". Similarly the fuzzy terms zero and positive are assigned to give the perception that
the level is "close to the desired level" and "low relative to desired level" respectively.
Similar to the level-error, let us divide the universe of discourse for the level-change-rate
( ) dh t
dt
,
[-0.1, 0.1] also in to three fuzzy sets negative, zero, and positive. Here the fuzzy term negative is
assumed to give a perception that the level-change-rate is closer to 0.1, which means that the
level is "falling at a fast rate". Similarly the fuzzy terms zero and positive are assigned to give the
perception that the level is "having no change" and "rising at a fast rate" respectively.
In order to achieve a smoother valve operation, let us divide the universe of discourse for the
valve opening u(t), [-1, 1] into five fuzzy sets close_fast, close_slow, no_change, open_slow, and
open_fast.
With two inputs taking three linguistic values, a maximum of nine rules can be created. Based on
heuristics, all the rules can be easily formed as given below:
If (level-error is negative) and (level-change-rate is negative) then ( valve is close_slow).
If (level-error is negative) and (level-change-rate is zero) then ( valve is close_slow).
If (level-error is negative) and (level-change-rate is positive) then ( valve is close_fast).
If (level-error is zero) and (level-change-rate is negative) then ( valve is open_slow).
If (level-error is zero) and (level-change-rate is zero) then ( valve is no_change).
If (level-error is zero) and (level-change-rate is positive) then ( valve is close_slow).
If (level-error is positive) and (level-change-rate is negative) then ( valve is open_fast).
If (level-error is positive) and (level-change-rate is zero) then ( valve is open_slow).
If (level-error is positive) and (level-change-rate is positive) then ( valve is open_slow).
Table 4 The fuzzy-rule base.
negative zero positive
negative ( valve is close_slow) ( valve is close_slow) ( valve is close_fast )
zero ( valve is open_slow ) ( valve is no_change) ( valve is close_slow )
positive ( valve is open_fast) ( valve is open_slow) ( valve is open_slow)
Fuzzy Membership functions:
Let us use triangular membership functions to design fuzzy sets for both the inputs and the output
of the fuzzy controller. These are drawn in Figure 19.

1

.7 .3 0 -.3 -.7 -1 .1 .07 .03 0 -.03 -.07 -.1

.6 .2 0 -.2 -.6 -1
dh/dt
e(t)
P Z N
P Z
N
1
close_fast close_slow no_change open_slow open_fast
u(t)
Figure 19 Fuzzy membership functions for inputs and outputs.
The fuzzy inference system:
Let us use Mamdani fuzzy inference system to design the controller. The T-norm and T-conorm
are to be defined by min and max operators respectively. For defuzzification, the centre of area
(COA) approach is to be used.
For the following crisp inputs:
e(t) = -0.525
( ) dh t
dt
= 0.0475
At the given crisp inputs, the fuzzy singletons are drawn to represent the fuzzy sets corresponding
to both the crisp inputs in Figure 20. Corresponding to the non-zero intersections of input
singletons and antecedent fuzzy membership functions, the active fuzzy rules are encircled in the
Table 5 of rule-base. It is clear from the figure and the Table 5 that four of the fuzzy rules are
fired at the given inputs.
Table 5 The fuzzy rule-base showing selected rules.

level-change-rate
negative zero positive
level-error

negative
( valve is close_slow) ( valve is close_slow) ( valve is close_fast )

zero
( valve is open_slow ) ( valve is no_change) ( valve is close_slow )
positive
( valve is open_fast) ( valve is open_slow) ( valve is open_slow)
Figure 20 Input fuzzification and determination of firing rules.
The active rules are drawn in the Figure 21. The complete fuzzy decision-making process is also
shown in the figure.


1
close_fast close_slow no_change open_slow open_fast
u(t)

.6 .2 0 -.2 -.6 -1
1
.1 .07 .03 0 -.03 -.07 -.1

P Z
N
dh/dt
1

.7 .3 0 -.3 -.7 -1
N Z P
e(t)
1
1

.7 .3 0 -.3 -.7 -1
N Z P
e(t)
1
1
.1 .07 .03 0 -.03 -.07 -.1

P Z
N
dh/dt
1
1
close_fast close_slow no_change open_slow open_fast
u(t)

.6 .2 0 -.2 -.6 -1
1

.7 .3 0 -.3 -.7 -1
N Z P
e(t)
1
1
.1 .07 .03 0 -.03 -.07 -.1

P Z
N
dh/dt
1
1
close_fast close_slow no_change open_slow open_fast
u(t)

.6 .2 0 -.2 -.6 -1
1
.1 .07 .03 0 -.03 -.07 -.1

P Z
N
dh/dt
1

.7 .3 0 -.3 -.7 -1
N Z P
e(t)
1
1
1
close_fast close_slow no_change open_slow open_fast
u(t)

.6 .2 0 -.2 -.6 -1
1
1
close_fast close_slow no_change open_slow open_fast
u(t)

.6 .2 0 -.2 -.6 -1
1
Rule 4:
Rule 3:
Rule 2:
Rule 1:
1
close_fast close_slow no_change open_slow open_fast
u(t)

.6 .2 0 -.2 -.6 -1
1
1
close_fast close_slow no_change open_slow open_fast
u(t)

.6 .2 0 -.2 -.6 -1
1
1
close_fast close_slow no_change open_slow open_fast
u(t)

.6 .2 0 -.2 -.6 -1
1
1
close_fast close_slow no_change open_slow open_fast
u(t)

.6 .2 0 -.2 -.6 -1
1
Max-min
Sum-min
Figure 21 Fuzzy decision-making process.
The following four fuzzy rules are fired.
Rule 1: If (level-error is negative) and (level-change-rate is zero) then ( valve is close_slow).
Rule 2: If (level-error is negative) and (level-change-rate is positive) then ( valve is close_fast).
Rule 3: If (level-error is zero) and (level-change-rate is zero) then ( valve is no_change).
Rule 4: If (level-error is zero) and (level-change-rate is positive) then ( valve is close_slow).
Based on the intersections of antecedent or premise membership functions with input singletons,
the rule firing strengths are computed as,

,1 1 , ,
,2 2 , ,
( ) 0.0225 0.0225
( ( )) ( ) min( , ) 0.32
0.07 0.07
( ) 0.0225 0.0175
( ( )) ( ) min( , ) 0.25
0.07 0.07
firinng level error N levle change rate Z
firinng level error N levle change rate P
firinng
dh t
w e t
dt
dh t
w e t
dt





,3 3 , ,
,4 4 , ,
( ) 0.0175 0.0225
( ( )) ( ) min( , ) 0.25
0.07 0.07
( ) 0.0225 0.0225
( ( )) ( ) min( , ) 0.32
0.07 0.07
level error Z levle change rate Z
firinng level error Z levle change rate P
dh t
w e t
dt
dh t
w e t
dt






The membership grade for implied consequent fuzzy sets can then be computed as,
,1 1 , _ , _
,2 2 , _ , _
,3 3 ,
( ( )) ( ( ( ))) min(0.32, ( ( )))
( ( )) ( ( ( ))) min(0.25, ( ( )))
( ( )) (
implication valve close slow valve close slow
implication valve close fast valve close fast
implication valve no
u t w u t u t
u t w u t u t
u t w






_ , _
,4 4 , _ , _
( ( ))) min(0.25, ( ( )))
( ( )) ( ( ( ))) min(0.32, ( ( )))
change valve no change
implication valve close slow valve close slow
u t u t
u t w u t u t


The membership grade for the overall implied fuzzy set can then be obtained as,
_ ,1 ,2 ,3 ,4
,1 ,2 ,3 ,4
( ( )) ( ( )) ( ( )) ( ( )) ( ( ))
max( ( ( )), ( ( )), ( ( )), ( ( )))
overall implication implication implication implication implication
implication implication implication implica tion
u t u t u t u t u t
u t u t u t u t


Using centroid of area (COA) method for defuzzification, the crisp value is computed as,
_
_
( )
( )
( )
This can easily be computed by dividing entire area coverd by the overall implied fuzzy
memberhsip function into convenient divisions wh
i overall implication i
Z
overall implication i
Z
d
z z
u t
z
N

( )
( )
1
1
ose centroids can directly be obtained.
Then,
( )
Here, is the area covered by division and is its centroid. If a division is created by
by chopping off at heigh
d
R
N
j j
j
N
j
j
j j
c area
u t
area
area j c

2
1 1
t a symmetric triangle that peaks at 1 and has a base length , its area
can be computed using simple geometry as, area = *( - )
2
0.25*0.25
Division 1: 0.9; 0.2*(0.25 )=0.04375
2
Divisi
l b
l
b l
c area
( ) ( ) ( )
( )
2 1
3 3
0.32*0.32
on 2: 0.5; 0.2*(0.32 )=0.05395
2
0.25*0.25
Division 3: 0.0; 0.2*(0.25 )=0.04375
2
0.9*0.04375 0.5*0.05395 0.0*0.04375
( ) 0.469
0.04375+0.05395+0.04375
c area
c area
u t


+ +

Let us test the designed fuzzy controller by applying for water level control in a simulation of
tank level control problem in Simulink under MATLAB environment. Using Fuzzy Logic
toolbox, a fuzzy inference system (FIS) can be created through a GUI interface. For procedural
detail, the toolbox manual can be referred. Figure 22 shows the plot of fuzzy membership
functions. In Figure 23, the fuzzy decision-making is shown graphically and crisp value of the
controller output for the same values of inputs as computed above are shown.
Figure 22 Fuzzy membership functions in fuzzy logic tool-box.
Figure 23 Fuzzy decision-making
Computing the crisp values of the controller output for various values of the two inputs e(t) and
( ) dh t
dt
over their universes of discourse, a complete control surface can be obtained. Such a
surface obtained through the toolbox is plotted in Figure 24.
Figure 24 The control surface.
The fuzzy controller FIS designed in the toolbox was included in the tank simulation available in
the toolbox as a simulink model sltankruleviewer.mdl. Performance of the controller is shown in
Figure 25. The reference or desired tank level is shown by yellow line and while the actual tank
level is shown in red line. It is clear from the figure that the controller is successful in brining to
and maintaining at the desired tank level set by the reference signal r(t) without any oscillatory
changes in the level during step changes in the tank level.
Figure 25 The control performance of the fuzzy controller.
The Sum-min composition
For computational efficiency, the COA method of defuzzification is often implemented as a sum-min
composition rather max-min composition applied earlier. In this approach, a point-wise summation is used
as the aggregation operator. In this the final crisp output via centroid defuzzifation is equal to the weighted
average of controids of the implied consequent MFs, where the weighting factor for each rule is equal to
the area under the implied consequent MF. There is therefore no need for computing the overall implied
fuzzy set. The complete computation procedure for the level controller problem is given below:
( )
( )
1
1
( )
Here is the area covered under the implied fuzzy membership by rule j
and is its centroid. The consequent membership functions are symmetric triangles
that peak
R
R
N
j j
j
N
j
j
j
j
c area
u t
area
area
c

2
1 1
at 1. Area of such a triangle with base length b and chopped off at a height l
can be computed using simple geometry as, area = *( - )
2
0.32*0.32
Rule 1: 0.5; 0.2*(0.32 )=0.05395
2
Rule 2
l
b l
c area
( ) ( ) ( )
2 2
3 3
4 4
0.25*0.25
: 0.9; 0.2*(0.25 )=0.04375
2
0.25*0.25
Rule 3: 0.0; 0.2*(0.25 )=0.04375
2
0.32*0.32
Rule 4: 0.5; 0.2*(0.32 )=0.05395
2
0.5*0.05395 0.9*0.04375 0.0*0.04375
( )
c area
c area
c area
u t



+ +

( )
( )
0.5*0.05395
0.4776
0.05395+0.04375+0.04375+0.05395
+

Effect of variation in number of fuzzy rules in the rule-base


Design objective of a fuzzy controller: Main design objective of a fuzzy control system is to devise
sufficient number of fuzzy rules so that the entire control surface is appropriately modelled. The fuzzy rules
divide the control surface into a finite number of patches or regions. The structured human knowledge is
then embedded into these regions through fuzzy rules. Sufficient overlap between patches provides a
smooth transition from one operating region to the other. For computational efficiency, number of fuzzy
rules should be as small as possible.
So far, we have seen that the above designed fuzzy controller uniformly divides the control surface into 9
overlapping regions. The structured human knowledge is then embedded in each region through a unique
fuzzy rule. As seen from simulation results, the designed controller provides excellent control performance.
Now let us reduce the number of fuzzy rules and see its effect on control performance. Let us ignore the
second input and redesign the controller with only level-error as the input variable and the valve opening as
the output variable, while keeping all the other parameters same as earlier. This would result into a control
surface uniformly divided into three overlapping regions with the following three embedded fuzzy rules.

If (level-error is negative) then ( valve is close_fast).
If (level-error is zero) then ( valve is no_change).
If (level-error is positive) then ( valve is open_fast).
Table 6 The fuzzy-rule base.
level-change-rate

none
level-error
negative
( valve is close_fast)
zero
( valve is no_change)
positive
( valve is open_fast)
As earlier, this fuzzy controller was implemented in MATLAB/Simulink using the fuzzy logic
toolbox. The resulting control surface is plotted in The control performance of the fuzzy
controller under similar operating conditions is shown in As clearly seen in the figure, the
controller performance has deteriorated substantially. The tank level oscillates heavily before
reaching the reference set-point. This is mainly because the fuzzy controller fails to account for
faster rate of change in tank-level closer to the set-point.
In order to improve performance, let us add the following two additional rules to counteract the
problem of faster rate of change in tank-level closer to the set-point.
If (level-error is zero) and (level-change-rate is negative) then ( valve is open_slow).
If (level-error is zero) and (level-change-rate is positive) then ( valve is close_slow).
After adding the above two rules, the resulting control surface is plotted in The control
performance of the fuzzy controller under similar operating conditions is shown in As clearly
seen in the figure, the controller performance has improved substantially. The tank level
oscillations near the reference set-point have completely died down. The control performance is
thus very similar to the case when all 9 fuzzy rules were used. It thus appears that just five rules
can provide satisfactory performance would be a better choice.
In addition to the number of fuzzy rules, there are several other parameters and alternative
methods of implementing various steps of fuzzy inference system. These include number and
type of membership functions used for implementing antecedent and consequent fuzzy sets,
methods of implementing T-norm, T-conorm, fuzzy implication operator, fuzzy aggregation
operator, defuzzification operator. All these have influence over the response of a fuzzy system.
Some sort of search procedure is therefore required for designing a fuzzy system with optimal
parameters. The procedure may be a heuristic search or a traditional optimisation routine.
II. A Fuzzy Controller for controlling the distance between
two cars
.. (Place into the toolbox and show the control surface. Justify possibilities for different
surfaces. Justify overlapping patches.)
Objectives: To answer:
How does fuzzy logic help to design a system having a fuzzy reasoning ability similar to
human beings? (Knowledge can directly be placed into the system even if precise values
can not be assigned to inputs by a human expert)
Why are overlapping regions required? (smooth response)
What is meant by softcomputing? How is it justified to have different possibilities for
solutions? (Different possibilities for different people can be accommodated within one
system design procedure)
2.3.7.2 A Two input single output Sugeno fuzzy model.
2.3.7.3 A Fuzzy controller for Controlling the Distance between two cars
2.4.7.4 A Fuzzy controller for Controlling the position of inverted pendulum
Jang, J.S.R., Sun, C.T., Mizutani, E.: 'Neuro-Fuzzy and Soft Computing', (Prentice Hall, Upper
Saddle River, NJ, 1997).
Yager, R.R., Filev, D.P.: 'A simple adaptive deffuzification method', IEEE Transactions on
Fuzzy Systems, 1993, 1(1), pp 69-78.
Jang, JSR, Sun, CT: 'Functional equivalence between radial basis function networks and fuzzy
inference systems', IEEE Transactions of Neural Networks, Jan. 1993, 4(1), pp 156-159.
Sugeno, M., Kang, G.T.: 'Structure identification of fuzzy model', Fuzzy Sets and Systems, 1988,
28, pp 15-33.
Takagi T. Sugeno, M.: 'Fuzzy identification of systems and its application to modelling and
control, IEEE Transactions on Systems, Man and Cybernetics, 1985, 15, pp 116-132.
Zadeh, L.A., 'Outline of a new approach to the analysis of complex systems and decision
processes', IEEE Trans. Systems, Man and Cybernetics, 3(1), pp 177-206.