Starting from:

$35

EE7207 MINI PROJECT

1
EE7207 MINI PROJECT

Complete and Submit All 2 Questions.
Note: You can use MatLab/Simulink or any other software package to perform your simulation.
1. FUZZY CONTROL. We first consider a truck-parking control problem, as shown in Figure 1.1. The objective
is to design a controller, without assuming a mathematical model of the truck, to park the truck anywhere on the
x-axis.
Figure 1.1
(a) Suppose that the truck can move forward at a constant speed of v = 0.5 m/s and it is assumed that the truck is
equipped with sensors that can measure location (x,y) and orientation θ (angle) at all times. The fuzzy logic
controller is to provide an input, u, to rotate the steering wheels and, consequently, to maneuver the truck from
any given initial condition to reach y=θ=0 at the parked position. In the simulation, the input variables are the
truck angle and the vertical position coordinate, y, while the output variable is the steering angle (signal), u. The
variable ranges are pre-assigned as
–100 ≤ y ≤ 100, –180 ≤ θ ≤ 180, –30 ≤ u ≤ 30.
Here, clockwise rotations are considered positive in θ, and, therefore, counter-clockwise are negative.
A simplified model to generate the values of (x,y) and orientation θ (angle) can be obtained from the geometry of
the truck shown in Figure 1.1 as follows:
(1.1)
where
2
The linguistic terms used in this design are given as follows:
 y-position Angle θ Steering angle u
Table 1.1
The associated membership functions for the variables y and θ are shown in Figure 1.2 and 1.3 respectively.
Figure 1.2
θ
Figure 1.3
The rule base used in simulation is summarized in Table 1.2. Each rule has the form IF y is Y AND θ is  THEN
u is U, as usual. A glance of these rules reveals the symmetry, an intrinsic property of this controller, which is
reasonable for this parking application since the truck can move in any direction.
Table 1.2
3
The membership function of the control variable u is shown in Figure 1.4.
Figure 1.4
Finally, we need to obtain the output action u under the given input conditions. The following standard Centre
of Gravity (COG) defuzzification formula is to be used in the simulation:
 ( )
( )
i
i
i U i i
U
COG
U i i
U
u u du
u
u du


=


Design a fuzzy logic controller and perform simulations for the following 4 initial conditions and plot out the
corresponding u(t), y(t) and θ(t) to show that y and θ reaches 0 at the end of the parked position.
Case 1 2 3 4
θ 0 90 220 -10
y 40 -30 30 10
x 20 10 40 50
Table 1.3
(b) For the given model in Equation (1.1), design a classical non-fuzzy logic controller to reach y=θ=0 given the
same 4 initial conditions listed in Table 1.3 and plot out the results.
4
2. CLUSTERING. Clustering is one of the most fundamental issues in pattern recognition. It plays a key role in
searching for structures in data. Given a finite set of data, X, the problem of clustering in X is to find several
cluster centres that can properly characterize relevant classes of X. In classical cluster analysis, these classes are
required to form a partition of X such that the degree of association is strong for data within blocks of the partition
and weak for data in different blocks. However, this requirement is too strong in many practical applications, and
it is thus desirable to replace it with a weaker requirement. When the requirement of a crisp partition of X is
replaced with a weaker requirement of a fuzzy partition or a fuzzy pseudopartition on X, we refer to the emerging
problem area as fuzzy clustering. Fuzzy pseudopartitions are often called fuzzy c partitions, where c designates
the number of fuzzy classes in the partition. There are two basic methods of fuzzy clustering. One of them, which
is based on fuzzy c-partitions, is called a fuzzy c-means (FCM) clustering method. However, the fuzzy c-means
method requires that the desired number of clusters be specified. This is a disadvantage whenever the clustering
problem does not specify any desired number of clusters. In such problems, the number of clusters should reflect,
in a natural way, the structure of given data. The other method, based on fuzzy equivalence relations, is called a
fuzzy equivalence relation-based hierarchical clustering method, works in this way.
2.1 Cosine Amplitude
Given a set of data array X,
X = {x1, x2, …, xn}
where each of the elements xi in the data array X is a vector of length m, that is,
1 2 m
T
i i i i x x x x =    


Fuzzy relations map elements from Cartesian product of 2 universes to [0,1] where the strength of the relation is
expressed by the membership function of the relation. Let R defined on X

X be a binary fuzzy relation from
single universe X to the same universe X. Each element of a relation R, rij, results from a pairwise comparison of
2 data samples, say xi and xj, where the strength of the relationship between data samples xi and xj is given by the
membership value expressing that strength, that is rij = μR(xi, xj). This relation matrix R will be of size n x n and
relates the similarity of the data samples.
The cosine amplitude method is a useful similarity method to calculate and ensures that the resultant relation R
will be symmetric and reflexive and is in fact a tolerance relation (see Section 2.2). It calculates rij in the following
manner:
1
2 2
1 1
 , where , 1, 2, ,
m
ik jk
k
ij
m m
ik jk
k k
x x
r i j n
x x
=
= =
= =
        

 
(2.1)
Close inspection of Equation (2.1) reveals that this method is related to the dot product for the cosine function.
When 2 vectors are collinear (most similar), their dot product is unity; when the 2 vectors are at right angles to
one another (most dissimilar), their dot product is zero.
2.2 Fuzzy Equivalence Relation
R is a fuzzy equivalence relation (also known as similarity relation) if all of the following 3 properties are
satisfied:
(a) Reflexive :
 R i i i ( x x x X , 1 for all . ) = 
(b) Symmetric :
  R i j R j i i j ( x x x x x x X , , for all , . ) =  ( )
(c) Transitive :        R i j R i j R i k i j k ( x x x x x x x x x X , and , , min , for all , , . ) = = →   1 2 1 2 ( ) ( ) ( )
5
A fuzzy tolerance relation, R1 defined on X

X, has properties of reflexivity and symmetry. R1 can be
transformed into a fuzzy equivalence relation R by at most (n-1) compositions where n is the cardinality of X.
That is
2
1 1 1 where 1
m
m R R R R m n

= =  −
Example 2.1: The following fuzzy tolerance relation R1
1
1 0.8 0.4 0.5 0.2
0.8 1 0.4 0.5 0.9
0.4 0.4 1 0.4 0.4
0.5 0.5 0.4 1 0.5
0.2 0.9 0.4 0.5 1
R
 
 
 
=  
 
 
   
is easily seen to be both reflexive and symmetric. However, it is not transitive, for example,
   R R R ( x x x x x x 1 2 2 5 1 5 , 0.8, , 0.9 but , 0.2 min 0.8,0.9 ) = = =  ( ) ( ) ( ).
A single composition operation results in
2
1 1 1
1 0.8 0.4 0.5 0.8
0.8 1 0.4 0.5 0.9
0.4 0.4 1 0.4 0.4 ,
0.5 0.5 0.4 1 0.5
0.8 0.9 0.4 0.5 1
R R R R
 
 
 
= = =  
 
 
   
is transitive since
       R i j R i j R i k i j k ( x x x x x x x x x X , and , , min , for all , , . ) = = →   1 2 1 2 ( ) ( ) ( )
Furthermore,
3 2 2
1 1 1 1
1 0.8 0.4 0.5 0.8
0.8 1 0.4 0.5 0.9
0.4 0.4 1 0.4 0.4 = .
0.5 0.5 0.4 1 0.5
0.8 0.9 0.4 0.5 1
R R R R R
 
 
 
= = =  
 
 
   
Hence, a simple algorithm to transform a fuzzy tolerance relation R1 into a fuzzy equivalence relation R is as
follows:
Algorithm 2.1
'
1 1
' '
1 1
'
1.
2. If , assign and goto Step 1.
3. Else Stop:
R R R
R R R R
R R
=
 =
=
2.3 α-Compatibility Class
It can be shown that if R is a fuzzy equivalence relation (also known as similarity relation) then each α-cut Rα is a
crisp equivalence relation. Effectively, then, we may use any fuzzy equivalence relation R and by taking any α-
6
cut Rα for any value
 (0,1, create a crisp equivalence relation that represents the presence of similarity
between the elements to the degree α. Each of these equivalence relations forms a partition of X.
Example 2.2: Let us illustrate this clustering approach with X = {x1, x2, x3, x4, x5} and using α-cut Rα on the fuzzy
equivalence relation R in Example 2.1.
1 0.8 0.4 0.5 0.8
0.8 1 0.4 0.5 0.9
0.4 0.4 1 0.4 0.4
0.5 0.5 0.4 1 0.5
0.8 0.9 0.4 0.5 1
R
 
 
 
=  
 
 
   
By taking α-cut Rα of fuzzy equivalence relation R at values of α = 1, 09, 0.8, 0.5 and 0.4, we get the following:
1
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
R
 
 
 
=  
 
 
   
,
0.9
1 0 0 0 0
0 1 0 0 1
0 0 1 0 0
0 0 0 1 0
0 1 0 0 1
R
 
 
 
=  
 
 
   
,
0.8
1 1 0 0 1
1 1 0 0 1
0 0 1 0 0
0 0 0 1 0
1 1 0 0 1
R
 
 
 
=  
 
 
   
,
0.5
1 1 0 1 1
1 1 0 1 1
0 0 1 0 0
1 1 0 1 1
1 1 0 1 1
R
 
 
 
=  
 
 
   
,
0.4
11111
11111
11111
11111
11111
R
 
 
 
=  
 
 
   
We can see that the clustering of the five data points according to the α level is as shown in Table 2.1
α-cut level Classification Results
1.0 {x1},{x2},{x3},{x4},{x5}
0.9 {x1},{x2, x5},{x3},{x4}
0.8 {x1, x2, x5},{x3},{x4}
0.5 {x1, x2, x4, x5},{x3}
0.4 {x1, x2, x3, x4, x5}
Table 2.1 Classification of 5 data points according to α-cut level
We can also express the classification results described in Table 2.1 with a tree classification diagram as shown
in Figure 2.1. In the figure, it can be observed that the higher the value of α, the finer is the classification. As α
gets larger, the results of fuzzy classification approach the trivial case when each data point is assigned to its own
class.
7
Figure 2.1 Classification Tree
2.4 Problem. 16 districts in a country have suffered flooding from a recent thunderstorm. The flooding in each
district are characterized according to three flooding levels : mild (<0.1 m), moderate (0.1 to 0.2 m), severe (0.2
to 0.3 m), catastrophic (> 0.3 m). The percentage of areas within a given district with each of the flooding levels
is given in Table 2.2.
Table 2.2 Flooding Levels in 16 Districts
(a) Use the cosine method in Equation (2.1) of Section 2.1 to generate the fuzzy tolerance relation R1.
(b) Use Algorithm 2.1 in Section 2.2 to transform R1 into a fuzzy equivalence relation R.
(c) Generate the α-cut Rα in Section 2.3 to provide classification classes for α-cut level = 0.4 and α-cut level =
0.8?
(d) If we want to classify the flooding for the whole county into 3 classes - Red, Yellow and Green. What
should be the appropriate the α-cut value?

More products