Neuro Fuzzy Control
Neuro Fuzzy Control
Neuro Fuzzy Control
CONTROL
J. Lilja Plsdttir
Poul Kristian Mhl
Alfonso Martnez del Hoyo Canterla
Soft Computing, 2005
University of Iceland
Table of contents
1. Introduction..................................................................................................... 4
2. Fuzzy logic controller...................................................................................... 4
2.1 PID controller ............................................................................................ 9
2.2 Fuzzy Logic Controller ............................................................................ 11
3. Controlling the Water-tank system using ANFIS .......................................... 22
3.1 Inverse control in water tank system....................................................... 23
3.2 Specialized learning................................................................................ 30
4. Inverse Learning........................................................................................... 35
4.1 Example.................................................................................................. 37
4.2 Multivalued Inverse ................................................................................. 45
4.3 Specialized Learning............................................................................... 46
4.4 Conclusions ............................................................................................ 46
5. ANFIS application - Equalizer....................................................................... 47
6. References ................................................................................................... 53
1. Introduction
Fuzzy control provides a formal methodology for representing, manipulating,
and implementing a humans heuristic knowledge about how to control a
system. Fuzzy control design methodology can be used to construct fuzzy
controllers for challenging real-world applications. In fuzzy control the focus is
on gaining an understanding of how to best control the process, then we load
this information directly into the fuzzy controller.
When we are going to design a fuzzy logic controller we should first understand
the behavior of the plant. For example how it reacts to inputs, what effects does
disturbances have, and what fundamental limitations are present (non-minimum
phase or unstable behaviour). Also we should take into account the
specifications in closed loop. Next an initial control design is performed, for
example with a PID or some other simple controller. If the simple controller
works there is no reason to implement something more complex; a fuzzy
controller will always be computationally more expensive and also it is more
difficult to develop.
Once a fuzzy controller is transformed into an adaptive network, the resulting
ANFIS can take advantage of all the neural network controller design
techniques proposed in the literature.
There are a number of control applications in which fuzzy logic can be useful.
For example we could mimick another working controller: fuzzy control makes
possible to use the heuristic knowledge from a human expert about how to
control a system. An experienced operator can summarize his control as a set
of rules with roughly correct membership functions. Later we could refine this
functions with a trial and error process or with learning algorithms. That will be
the first part of this project; we will be developing fuzzy controllers for a water
tank system.
Also we could apply fuzzy methods to inverse control, for example we could
train ANFIS to invert a plant; also ANFIS can be used for adaptive inverse
control. Finally, other fields of application in control would be specialized
learning, gain scheduling and others.
We are interested in the inflow as the input variable and the height of the water
H(t) as the output. The system is strongly non-linear and can be described by
the following equations:
V
H (t )
=A
= X (t ) a H (t )
t
t
In the simulations we work with a model which computes this equation. The
input is the inflow and the outputs are an overflow flag (that could be used for
example for an on-off controller), the outflow and the water level.
We could linearize the system around a stable working point. Then we should
decompose the variables as the sum of a steady state component and a
changing component: X(t)=Xo+x(t) and H(t)=Ho+h(t). Using the first order Taylor
polynomial around the steady state for the non-linear function (the square root
of the water height), and noticing that:
X o = a Ho ,
we obtain the transfer function (which is valid only near the working point):
h(t )
=
G ( s) =
x(t )
2 Ho
a
2A Ho
s
1
a
That is a first order model whose gain and time constant change with the
working point.
However, the system to control is not exactly this one. We do not have direct
access to the inflow in the water tank because the inflow is controlled through a
valve. This valve changes its position with velocity proportional to an input,
which will be the control signal of the system. We will work with the following
model for the valve:
We see that the output is non-stable: since the control signal is the velocity of
the valve, a positive input means that the valve will finish completely opened
after some time. Then the tank fills with the maximum slope (0.5). However the
output is limited to values in the interval (0,2) so it saturates in 2m (the tank
cannot contain more water after it is full).
Now let us study response of the system in closed loop:
We see that somehow the water tank system behaves like a second order
system. We would like less overshoot in the ouput (there is nearly 40%) and a
faster answer, but the rise time (time in which the output achieves 90% of the
final value for the first time) cannot change much since the inflow is limited to
0.5 because of the valve.
I
Ds
+
,
s (1 / N ) s + 1
Figure 9: Model for the step response in closed loop with PID controller.
That is a better result than before since the overshoot is now less than 20% and
we also got a slightly shorter rising time. We try this controller with the reference
signal that we are interested in tracking:
10
Figure 11: Response to the reference in closed loop with PID controller.
We notice that there is a higher overshoot in the filling than when tank is
emptied. This is caused by the difference between the inflow and the outflow;
for example for a height of 1.5m the outflow is 0.05 2 g 1.5 = 0.27 whereas the
maximum inflow is always 0.5, then we can see that the slope when the tank is
filling is higher than when it is emptied. The PID controller is linear so there will
be a higher overshoot in the filling, because of the higher slope. This is a
limitation of the linear controllers.
These rules could have been supplied by an expert human. The fuzzy controller
then tries to implement this knowledge of the system.
The membership functions for the input variable Level (which is the error of the
actual level) are chosen Gaussian functions to have a smooth answer. We
should study our application to select the parameters of the functions. The tank
11
starts with 0.5m and the reference will change between 0.5m and 1.5m. Then
when the level is okay the error is zero, and if we suppose that the fuzzy
controller is working fine, the maximum errors will be -1, which means that the
level is too high, and 1, which means that the level is too low.
Then the fuzzy set Okay is centered in zero (no error means the level is okay).
As we saw before we can set 1 as the minimum absolute value of the error that
achieves total membership (MF=1) to the sets High and Low. For lower
values we have a Gaussian and for bigger values we maintain the total
membership.
Figure 12: Membership functions of the input Level: High, Okay and Low.
Figure 13: MF of the output Valve: Close fast, No change and Open fast.
12
The Mamdani model will use the product for the AND operator and for the
implication, and the max for the aggregation. The output is defuzzified with the
centroid of area method:
In our system the inferred output of each rule is a fuzzy set scaled down by the
firing strength via product operator; the desired crisp output (big red bar) is
obtained with the defuzzification:
Figure 15: An example of how the rules are fired in our system.
Also we show the model of the Mamdani system for the simulation:
13
The model of the water tank system with the fuzzy logic controller that we used
for the simulations:
Figure 17: The model of the water tank system used in the simulation.
The performance of this fuzzy logic controller is not good because we obtained
a big oscillation in the output around the desired level:
14
Figure 18: Output level using triangular membership function for the output.
Note: Yellow =reference, Pink=level, Blue=Inflow, Cian=Outflow, Green=Control, Red=Error
Also we could try other membership functions for the output, such as the
generalized bell:
Figure 19: Output level using generalized bell membership function for the output.
15
Figure 20: Output level using Gaussian membership function for the output.
16
Figure 21: Output level using another Gaussian membership function for the output.
We observe that there are no important changes. We could conclude that three
rules are not sufficient since the water level tends to oscillate around the
desired level.
The solution to this problem is to slow down the output when we are close to the
reference. We can achieve this effect by adding two extra rules and an new
input variable that takes in account the changing in the height of the water, that
is the changing rate of the level:
With these rules the level is going to reduce the slope when it is close to the
reference so there will be fewer oscillations.
The membership functions for the Rate variable:
17
Figure 22: Membership functions of the input Rate: Negative, None and Positive.
We also have to add the new values to the output membership functions. As a
first approach we could set Close slow and Open slow centered in -0.3 and
0.3 respectively:
However we saw that the water tank empties slower than it fills. Therefore we
could use the power of the membership functions to design a controller that
overcome this difficulty: we set smaller values for the Open slow membership
function because we saw that the output had smaller slope when the tank
empties. Then we center the Open slow membership function in 0.3:
18
19
Figure 26: An example of how the rules are fired in our system.
20
Figure 28: Output level using the fuzzy logic controller with best performance.
We see that there is no oscillation and that we solved the problem of the
difference in the flows. We could try with other membership functions for the
input, for example triangular membership functions, but the results were worse:
Figure 29: Output level using triangular membership functions for the input.
21
1
In1
x_d(n)
e(n)
u(n)
Fuzzy Logic
Controller
VALVE
Subsystem
x(n)
WATER
TANK
1
Out1
tank 2
0.5
tank max
inflow
Figure 30: Controlling the water tank using fuzzy logic controller
As it can be seen this is similar to what was done in the part, where the FIS was
generated manually by a human expert. But of course it would be desirable to
be able to automatically fine-tune or maybe even automatically design the FIS
from scratch.
The first idea was simply to use ANFIS to train the controller. However it soon
became clear that this was not directly possible. This is because ANFIS both
need the input signal, e(n), and the desired output from the FIS, u(n). But clearly
the desired response u(n) of is unknown in this part. (otherwise we would
actually be back at the human expert generating the FIS)
From the model it can quite easy be seen what an appropriate FIS would be
expected to do. The rules of the FIS would be something similar to the following
3 rules.
1. IF e(n) is positive, then output should be positive. This is equal to say
water level should increase, and thus valve should be opened.
2. IF e(n) is negative, then output should be negative. This is equal to say
water level should decrease, and thus valve should be closed.
3. IF e(n) is close to zero, then output should be zero. This is equal to say
water level is ok, and thus valve should not be changed.
These basic ideas of an appropriate behaviour of the controller could of course
be used to design a not to bad FIS and from this make the tuning using ANFIS.
However this would not change the fact that the desired output of the FIS would
22
be required, and since this is still not known, we were quite stuck using this
approach.
1
In1
x_d(n)
u(n)
Fuzzy Logic
Controller
VALVE
Subsystem
WATER
TANK
Out1
tank 2
0.5
tank max
inflow
23
water level / m
1.5
0.5
50
100
150
t/s
200
250
This is quite obviously not some data that can be used to train the ANFIS. The
system response simply goes to the maximum possible water level, 2m, in very
short time. And in fact it does not change the look of the response what kind of
input signal is used. This is of course due to the fact that the desired water level
always is a positive number, and thus the system has no chance to decrease
the water level by giving a negative input to the valve.
This very clearly tells us that it is not easy to construct a pure feed-forward
controller to control this system.
The following figure shows the system response if a random signal in the range
1 is used as input.
24
water level / m
1.5
0.5
-0.5
-1
50
100
150
t/s
200
250
This signal is much more likely to be able to train the ANFIS to fit the system.
However this would of course require the possibility of negative values to the
controller, and thus a closed loop system as in Error! Reference source not
found..
Using this data it was tried to train a Sugeno FIS with the following parameters
(generated using the Matlab function genfis1).
The following figure shows the training error result when training the ANFIS
over 50 epochs.
25
The poor convergence quite clearly indicates that the ANFIS has not been fitted
very well to the data. This is furthermore confirmed by plotting the training-data
vs. the output of the ANFIS with the same data as input.
This on its own indicated that this ANFIS controller would not be usable in the
system. However it was tried and as expected it did no good. The following
figure shows that it is unable to control a square input signal very well. The plot
also shows the system without any controller and a simple feedback loop, which
performs better than the constructed ANFIS controller.
26
1.8
fuzzy control
desired signal
no control
1.6
1.4
1.2
1
0.8
0.6
0.4
0.2
0
50
100
150
200
250
300
At this time we thought that it might be a better idea to use a slower varying
signal, instead of the random signal to train the ANFIS. It was then decided to
use a square input signal instead, which is shown together with the
corresponding system response in the following figure.
27
water level / m
1.5
0.5
-0.5
-1
50
100
150
t/s
200
250
Using this to train an ANFIS similar to the one used previously gave the
following results.
28
Figure 39: Training data vs. ANFIS output (square training data)
Even though the training error is much smaller this time, it was still not a
desirable result, but nevertheless it was fitting the training data somewhat better
than what was the case with the random data. So it was tried to use this
controller in the system.
2
fuzzy control
desired signal
no control
1.8
1.6
1.4
1.2
1
0.8
0.6
0.4
0.2
0
50
100
150
200
250
300
Figure 40: System using the ANFIS controller (square training data)
29
It is very obvious that the controller performance is pretty much the same as
with the random data used as training data.
At this point we gave up trying to implement an ANFIS controller. One of the
reasons why this kind of controller does not work, might be that the system
does not have a singular solution to its inverse. This is due to the square root
element in the water tank part of the system, which can be seen in the following
model of the water tank part of the system.
1
flow
in
1/s
sum
tank
volume
1/area
1/area
sqrt(2*9.8*u)
sqrt(2gh)
-K-
outletArea
1
flow
out
This is one of the limitations using inverse control. Since the ANFIS cannot
know which of the possible solutions to choose, it chooses a mean solution,
which in most cases (and in out case) is of no use.
30
value
50
0
-50
-100
-150
8
sample #
10
12
14
16
4
x 10
PID input
PID output
value
-50
-100
-150
3.14
3.141
3.142
3.143
3.144
3.145
sample #
3.146
3.147
3.148
3.149
3.15
4
x 10
As it can be seen, relatively small input to the PID controller results in pretty
huge output values. Furthermore the process is not totally identical for positive
and negative inputs. This is due to the fact that the water tank is able to fill up
water faster than it can reduce the amount of water in the tank.
Altogether this turns out not to be very easy to duplicate for the ANFIS
controller. One reason to this is the very fast and steep transient in the PID
response followed by a non-linear relatively slow response.
It was tried to train the ANFIS using different delayed versions of the input
signal. This was to some degree successful since it helped the ANFIS to make
a better fit. However at no point the ANFIS was able to make a satisfying fit.
One of the most successful fits is shown in the figure below.
31
Figure 43: PID data pairs vs. ANFIS output for the same input
Even though this gave the best fit we were able to obtain, it was not the ANFIS
which resulted in the best actual performance when applied as controller in the
water tank system.
The following figure shows two different ANFIS controllers made. The first one
uses 5 MFs for one input, while the second one uses 10 MFs and still one
input. This clearly shows how increasing the number of MFs can help us fit the
PID controller better, in sense of in average getting closer to the desired water
level. However it on the other hand has more ripple than in the first example.
A system where delayed versions of the input also was used as input to the
ANFIS, gave less ripple, but on the other hand had a tendency to occasionally
turn the valve in the wrong direction, i.e. adding more water when less water
was desired and the other way around.
All in all this pointed to that a compromise has to be made: Enough MFs
together with a correct number of delayed versions of the input.
However the computational time for training the ANFIS increases very fast as
the number of MFs and inputs is increased. So at this late state of the project
it was not possible to optimize this further.
32
water level / m
0.5
desired level
actual level
0
50
100
150
200
250
t/s
300
350
400
450
500
1.6
1.4
water level / m
1.2
0.8
0.6
0.4
0.2
50
100
150
200
250
t/s
300
350
400
450
500
33
Finally the plot below shows the membership functions before and after the
ANFIS training for the 5 MFs example. This shows how the membership
functions has been stretched out by the training process, and most important
the first and the last membership function has been moved, so the middle is
actually moved outside the range of the plot. This indicates that the ANFIS has
been trained to treat extreme values in a special way. These actually
correspond to the case when the PID gives a large () output.
Membership functions before training
in1mf1
1
in1mf2
in1mf3
in1mf4
in1mf5
Degree of membership
0.8
0.6
0.4
0.2
0
-1
-0.5
0.5
1.5
input1
in1mf2
in1mf3
in1mf4
in1mf5
Degree of membership
0.8
0.6
0.4
0.2
0
-1
-0.5
0.5
1.5
input1
After having worked with ANFIS in this project it is clear that ANFIS is not just a
general purpose tool. It is very good at handling multiple input / multiple output
complex systems which can be hard/impossible to design directly by a human
expert.
However in this water tank control system it actually was easier to generate a
FIS manually using mostly logical sense and a few formulas. The ANFIS system
showed to be hard to use, when not having directly access to the desired output
of the system and when having to be used in a feedback control loop.
In the inverse control case it also was shown that ANFIS has certain limitations
when the system does not have a unique inverse.
Finally the ANFIS was used in a general specialized learning setup. Here the
Sugeno type of ANFIS had problems with imitate the drastic changes of the PID
controller. Nevertheless our simulations showed that the ANFIS most likely has
the possibility to copy the PID controller and in some sense perform better by
producing less overshoot. However to achieve this it would require more time
34
4. Inverse Learning
The simplest approach to control, conceptually, is to make an inverse model of
the plant to be controlled. The development of inverse learning for designing
neuro-fuzzy controllers involves two phases. In the learning phase, an on-line or
off-line technique is used to model the inverse dynamics of the plant. The
obtained neuro-fuzzy model , which represents the inverse dynamics of the
plant, is then used to generate control actions in the application phase. These
two phases can proceed simultaneously, hence this design method fits in
perfectly with the classical adaptive control scheme.
For off-line applications, we have to collect a set of training data pairs and then
train the network in the batch mode. For on-line applications to cope with timevarying plants, the control actions are generated every n time steps while online learning occurs at every time step. Alternatively, we can generate the
control sequence at every time step and apply only the first component to the
plant.
The basic idea of inverse control is to derive the plant with a signal from a
controller whose transfer function is the inverse of that of the plant itself. Since
the plant model is generally unknown, it is necessary to adapt or adjust the
parameters of the controller in order to create a true plant inverse.
Assuming that the order of the plant (the number of state variables) is known
and that the plant can be described by
x(k + 1) = f (x(k ), u (k ))
where x(k + 1) is the state vector at time k + 1 , x(k ) is the state vector at time k ,
and u (k ) is the control signal at time k (for simplicity we assume u (k ) is a
scalar). Accordingly the state vector at time k + 2 is
x(k + 2 ) = f (x(k + 1), u (k + 1)) = f (f (x(k ), u (k )), u (k + 1))
In general
x(k + n ) = F(x(k ), U )
(u (k ), u (k + 1),..., u (k + n 1))T
35
The updating equation for the state vector x expresses, that the sequence of
control inputs U will drive the state vector from x(k ) to x(k + n ) in n time steps.
If we assume that the inverse of the plant model does exist, then U can be
expressed as a function of x(k ) and x(k + n ) ,
U = G (x(k ), x(k + n ))
U = W 1 x(k + n ) A n x(k )
When we cannot solve as easily for the inverse system we can use an adaptive
network, or ANFIS, with 2n inputs and n outputs to approximate G , assuming
that all state variables are available for measurement. The ANFIS is then used
to learn the inverse of the plant by fitting the data pairs (x(k ), x(k + 1); u (k )) . Then
we have the training data pairs
(x(k ) , x(k + n) ; U )
T
36
4.1 Example
Now we will look at an example that shows that not only must the inverse of the
plant exist, it must also be unique.
Like every text book, we use the problem where the plant
37
y (k + 1) =
y (k )u (k )
1 + y (k )
tan u (k )
2k
2k
y kd = 0.6 sin
+ 0.2 sin
250
50
We began by choosing = 1 and the ANFIS had a total of nine rules and three
membership functions. We used 100 data points for training and 30 epochs.
The more epochs we used the more the membership functions changed during
training (as to be expected). If only one epoch is used then the membership
functions does not change at all. This gave excellent results (Figure 47Figure
48Figure 49Figure 50Figure 51).
1.5
0.5
y(k)
u(k)
0.5
0
0
0.5
0.5
1
1.5
0
20
40
60
80
100
20
40
60
Time
Time
Training Data
Training Data
80
100
y(k+1)
0.5
0
0.5
1
1
0
2
2
1
1
0
y(k)
y(k+1)
y(k)
38
Error Curves
RootMeanSquared Error
0.04
0.035
0.03
0.025
0.02
0.015
0.01
0.005
10
15
Epochs
20
25
30
20
25
30
Step Sizes
0.13
0.12
0.11
0.1
0.09
0.08
10
15
Epochs
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
1
0.5
0
0.5
1
1.5
2
1.5
1
0.5
0
0.5
1
1.5
y(k+1)
1.5
0.5
0.5
1.5
y(k)
39
2
desired
actual
1
0
1
10
20
30
40
50
Time
60
70
80
90
100
10
20
30
40
50
Time
60
70
80
90
100
10
20
30
40
50
Time
60
70
80
90
100
0.04
Error
0.02
0
0.02
u(k)
0.5
=1
Next we tried using less then one and began with = 0.8 . We used 3
generalized bell membership functions, 100 data points for training and 30
epochs. We clearly see that the quality deteriorates, but it still gives very good
results (figures Figure 52Figure 53Figure 54Figure 55 and Figure 56).
1.5
1
0.5
y(k)
u(k)
0.5
0
0
0.5
0.5
1
1.5
0
20
40
60
80
100
20
40
60
Time
Time
Training Data
Training Data
80
100
1
y(k+1)
0.5
0
0.5
1
1
0
2
2
0
y(k)
y(k+1)
y(k)
Error Curves
RootMeanSquared Error
0.03
0.025
0.02
0.015
0.01
0.005
10
15
Epochs
20
25
30
20
25
30
Step Sizes
0.13
0.12
0.11
0.1
0.09
0.08
0.07
10
15
Epochs
Figure 53: Error curves (upper) and step sizes (lower) ( = 0.8 )
40
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
ANFIS Output
1
0
1
2
3
4
5
6
7
1.5
1
1.5
0.5
0.5
0
0.5
0.5
1.5
1.5
y(k+1)
y(k)
1
0
1
10
20
30
40
50
Time
60
70
80
90
100
10
20
30
40
50
Time
60
70
80
90
100
10
20
30
40
50
Time
60
70
80
90
100
0.15
Error
0.1
0.05
0
0.05
u(k)
0.5
= 0 .8
Next we tried to use = 0.5 . We clearly see that the quality deteriorates more
than before. There is always a question, however, if training is inadequate. We
therefore tried to increase the size of the training data set from 100 to 300, and
then from 300 to 1000 data points, used 5 membership functions instead of 3,
and increased the number of epochs from 30 to 50. The results were still not
good (Figure 57Figure 58Figure 59Figure 60Figure 61).
41
1
0.5
y(k)
u(k)
0.5
0
0.5
0.5
1
0
100
200
300
100
200
Time
Time
Training Data
Training Data
300
1.5
1
0.5
y(k+1)
0.5
0.5
0.5
1
0
1.5
2
0
y(k)
0
1
y(k+1)
y(k)
0.05
0.04
0.03
0.02
0.01
0
10
15
20
25
Epochs
30
35
40
45
50
30
35
40
45
50
Step Sizes
0.1
0.09
0.08
0.07
0.06
0.05
0.04
10
15
20
25
Epochs
Figure 58: Error curves (upper) and step sizes (lower) ( = 0.5 )
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0.5
0.5
1
0.8
0.6
0.6
0.4
0.4
0.2
0.2
1
0.5
0.5
0.5
0.8
0.5
0.5
0.5
42
ANFIS Output
10
15
20
1
0.5
1
0.5
0
0
0.5
0.5
1
y(k+1)
y(k)
2
desired
actual
1
0
1
50
100
150
Time
200
250
300
50
100
150
Time
200
250
300
50
100
150
Time
200
250
300
Error
10
5
0
5
10
u(k)
0
10
20
When we further decreased the value of we got really bad results and no
matter how we tried to use more exhaustive learning. And to show one extreme
case, we tried using = 0.1 . We tried 300 and 1000 data points for training,
used 5 Generalized bell membership functions and 50 and 100 epochs. The
result was really bad (as to be expected) (Figure 62Figure 63Figure 64,Figure
65Figure 66).
0.8
0.6
y(k)
u(k)
0.5
0.4
0.2
0.5
0
0.2
0
100
200
300
100
200
Time
Time
Training Data
Training Data
300
0.4
0.3
y(k+1)
0.2
0.5
0.1
0.5
0.1
0.2
0.2
0.3
0.5
0
0
0.5
y(k+1)
0.2
0
0.2
0.4
0.2
y(k)
0.6
0.8
y(k)
43
Error Curves
RootMeanSquared Error
0.15
0.14
0.13
0.12
0.11
0.1
0.09
10
15
20
25
Epochs
30
35
40
45
50
30
35
40
45
50
Step Sizes
0.1
0.09
0.08
0.07
0.06
0.05
10
15
20
25
Epochs
Figure 63: Error curves (upper) and step sizes (lower) ( = 0.1 )
Initial MFs on y(k)
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0
0.2
0.2
0
0.2
0.4
0.6
0
0.2
0.8
0.1
0.2
0.3
0.2
0.3
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0
0.2
0.1
0.2
0
0.2
0.4
0.6
0
0.2
0.8
0.1
0.1
ANFIS Output
30
25
20
15
10
5
0
5
10
15
0.3
0.2
0.8
0.1
0.6
0
0.4
0.2
0.1
0.2
y(k+1)
0
0.2
y(k)
44
2
desired
actual
1
0
1
50
100
150
Time
200
250
300
50
100
150
Time
200
250
300
50
100
150
Time
200
250
300
50
Error
0
50
100
3000
u(k)
2000
1000
0
1000
We also plotted the result from all the tested values on the same graph for
comparison.
2
desired output
=0.1
=0.5
=0.8
=1
1.5
0.5
0.5
50
100
150
200
250
300
When looking at the different figures representing the same nonlinear plant but
with different values of , we first noted the distribution of the training points.
For lower valued we got the training data points closer together, i.e. they
were not uniformly distributed. For close to or equal to one we got more
uniformly distributed training points - and that is of course how we want it to be.
y (k )u (k )
1 + y (k )
tan u (k )
as
y (k + 1) = b(k )u (k ) tan u (k )
45
where
b(k ) =
y (k )
1 + y (k )2
is constant for a given current state. The maximum of b(k ) occurs when
db(k )
1 + y (k )
=
dy (k ) 1 + y (k )2
4.4 Conclusions
We can train an ANFIS to approximate a certain nonlinear function. Because
there is no local extremity in a fuzzy logic system, the convergence to the
inverse solution is always guaranteed. Also the fuzzy controller has profit it
computational aspects. But when the function being approximated has strong
nonlinearity or has many inputs, lots of fuzzy rules are needed and large
memory size may be required.
46
We looked at an example and saw that is was not only recessary for the plant to
have an inverse, but it also needed to have a unique one.
{
}
= {x R s (t ) = 1}
P+ = x R 2 s(t ) = 1
P
47
x(t1)
1
0
1
2
3
3
x(t1)
1
0
1
2
3
3
0
x(t)
Threshold = 0
2
0
x(t1) 2
0
2
0
2
x(t1) 2
0
2
x(t)
x(t)
1
0
1
x(t1)
1
2
0
1
0
2
x(t1) 2
2
0
2
x(t)
0
x(t)
H ( z ) = 0.5 + z 1
48
And we made these training data set which has SNR = 20 and SNR = 3,
respectively.
Original Signals
100
200
300
400
500
100
Noise
3
100
200
200
300
400
500
300
400
500
100
200
300
400
500
Original Signals
100
200
300
400
500
100
Noise
3
2
100
200
300
400
500
200
300
400
500
100
200
300
400
500
FiguresFigure 72Figure 73 show the distribution and density for the above
training data.
Training Data Density
Training Data Distribution
Density Contours
3
0.5
x(t1)
x(t1)
1
0
0
2
1
0
1
0
x(t)
2
x(t1)
0
1
0
x(t)
x(t)
49
Density Contours
3
1
2
0.5
x(t1)
x(t1)
1
0
2
2
0
2
0
x(t)
0
1
2
x(t1)
0
x(t)
x(t)
Obviously, we can more easily distinguise between the tops in the density
function when we have higher SNR ratio. There is, of course, easier to separate
the two signals if the strength of the signal compared to the noise is high.
Since the noise is Gaussian around vectors in P+ and P , we can identify the
peaks of the density functions and define the confidence region of the ANFIS
equalizer as the internal area surrounded by the contour at height 0.05. We now
look at decision boundaries generated by the ANFIS with four and nine rules,
respectively (100 epochs, generalized bell mf). Figures Figure 74 to Figure 77
show the results.
Threshold = 0
1
1
1
0
0
1
x(t1)
0
x(t)
x(t1)
0
x(t)
Decision Boundary
1.5
1
1
0.5
x(t1)
1
1
0
0.5
0
x(t1)
1
1
0
x(t)
1.5
1
0
x(t)
Figure 74: ANFIS equalizer using two membership function per variable (SNR = 20)
ANFIS Surface: 4 Rules
Threshold = 0
2
0
0
2
x(t1)
2
x(t1)
x(t)
0
x(t)
Decision Boundary
3
x(t1)
1
2
0
2
x(t1)
0
1
0
x(t)
3
2
x(t)
Figure 75: ANFIS equalizer using two membership function per variable (SNR 3)
50
Threshold = 0
1
1
1
0
0
1
x(t1)
0
x(t)
x(t1)
0
x(t)
Decision Boundary
1.5
1
1
0.5
x(t1)
1
1
0
0.5
0
x(t1)
1
1
0
x(t)
1.5
1
0
x(t)
Figure 76: ANFIS equalizer using three membership function per variable (SNR = 20)
Threshold = 0
2
0
0
2
x(t1)
2
x(t1)
x(t)
0
x(t)
Decision Boundary
3
x(t1)
1
2
0
2
x(t1)
0
1
0
x(t)
3
2
x(t)
Figure 77: ANFIS equalizer using three membership function per variable (SNR 3)
51
52
6. References
1. J.-S. R. Jang, C.-T. Sun, E. Mizutani. Neuro-Fuzzy and Soft Computing.
Prentice Hall, 1997.
2. Jyh-Shing, Roger Jang and Chuen-Tsai Sun. Neuro-Fuzzy Modeling and
Control. IEEE , 1995.
3. Marwan Bikdash, Maria Walden, and Eddie L. Branch. Multi-Valuedness
Destroys Data Contiguity for Inverse-Learning Control. NASA
Autonomous Control Engineering Center, 1999.
4. Sang-Moon Ryu, Dong-Jo Park and Seok-Yong Oh. Inverse Mapping
Using FLS and its Application to Control. IEEE, 1995.
5. Jan Jantzen. Neural and Neurofuzzy Control. Technical University of
Danmark. Tech. report no 99-H 999, 2003.
6. Chin_teng Lin and Chia-Feng Juang. An Adaptive Neural Fuzzy Filter
and its Applications. IEEE, 1996.
7. Colin F.N. Cowan. Communications Equalization Using Non-Linear
Adaptive Networks. IEEE, 1991.
8. Li-Xin Wang. Fuzzy Adaptive Filters, with Application to Nonlinear
Channel Equalization. IEEE, 1993.
9. Bihua Lin, Pu Han, Dongfeng Wang, Qigang Gun. Control of BoilerTurbine Unit Based on Adaptive Neuro-Fuzzy Inference System. IEEE,
2003.
10. S. Ushakumari. Adaptive Neuro-Fuzzy Controller for Improved
Performance of a Permanent Magnet Brushless DC Motor. IEEE, 2001.
53