Open access peer-reviewed chapter

Compensatory Adaptive Neural Fuzzy Inference System

Written By

Rabah Mellah, Hocine Khati, Hand Talem and Said Guermah

Submitted: 18 November 2020 Reviewed: 16 January 2021 Published: 15 February 2021

DOI: 10.5772/intechopen.96050

From the Edited Volume

Fuzzy Systems - Theory and Applications

Edited by Constantin Volosencu

Chapter metrics overview

255 Chapter Downloads

View Full Metrics


The traditional approach to fuzzy design is based on knowledge acquired by expert operators formulated into rules. However, operators may not be able to translate their knowledge and experience into a fuzzy logic controller. In addition, most adaptive fuzzy controllers present difficulties in determining appropriate fuzzy rules and appropriate membership functions. This chapter presents adaptive neural-fuzzy controller equipped with compensatory fuzzy control in order to adjust membership functions, and as well to optimize the adaptive reasoning by using a compensatory learning algorithm. An analysis of stability and transparency based on a passivity framework is carried out. The resulting controllers are implemented on a two degree of freedom robotic system. The simulation results obtained show a fairly high accuracy in terms of position and velocity tracking, what highlights the effectiveness of the proposed controllers.


  • control
  • fuzzy logic
  • neural-fuzzy
  • compensatory fuzzy
  • Kalman filter
  • manipulator robot

1. Introduction

The advantage of fuzzy control is that the fuzzy system can model any continuous (sufficiently smooth) nonlinear function in a compact set and the modeling error decreases [1]. Fuzzy logic resembles human analysis in its use of inaccurate information to create decisions. Many such problems can be formulated as the minimization of functional defined over a class of admissible domains [2]. However, the difficulty in deploying fuzzy clustering strategies along with the high calculating cost and without update the parameters were their disadvantage [3].

On the other hand, a major concern of researchers is turned towards the combination of fuzzy logic and neural network. In this combination, a fuzzy reasoning is followed within multilayered hierarchical neural network. The parameters are represented by connection weights or involved in unit functions. They are learned the actual data [4]. In the near past, ANFIS (Adaptive Neural Fuzzy Inference System) models have become very popular for two reasons: the first reason is that in calibrating of non-linear relationships they offer more advantages over conventional modeling techniques, namely the ability to handle large amounts of noisy data from dynamic and non-linear systems, particularly when the underlying physical relationships are not fully understood. The second reason is that they facilitate the solving of linear systems which include the interpolation modeling such as time series [5].

The reason why authors used ANFIS is that it not only includes the characteristics of both methods but also eliminates some disadvantages in case of their lonely use [6]. Unfortunately, conventional neural fuzzy systems can only optimize the fuzzy membership functions under specially defined fuzzy operators which are unchangeable forever, which makes it use the local optimization technique rather than the global optimization technique [7, 8]. Thus an adaptive neural fuzzy controller with compensatory fuzzy is most suitable in an environment where system dynamics change dramatically, become highly nonlinear, and in principle not fully known.

On the ground of these observations, several optimal and systematic methods have been developed for the design of neural fuzzy controllers with compensatory fuzzy. Among these methods, we have retained the compensatory adaptive neural fuzzy inference system approach which consists in adjusting not only fuzzy membership functions but also dynamically optimize the adaptive fuzzy reasoning. Besides that, ANFIS is a class of adaptive networks that are functionally equivalent to a first order Takagi-Sugeno fuzzy model.

Recently compensatory adaptive neural fuzzy inference system control has gained more attention from the control Community in general, as adaptive fuzzy systems are of crucial importance in several areas. The compensatory adaptive neural fuzzy inference system is preferred to deal with nonlinearities and complexity by working on data characterized by incompleteness and inaccuracy. Therefore, it offers powerful skills, such as adaptive adjustment, parallelism, tolerance error and generalization for the neural fuzzy controller. Thus the optimal methods are used to adjust and optimize the parameters of neural fuzzy controllers through an optimization algorithm in order to improve the control performance [9].

In this chapter, we will present and analyze in section 2 the structure of adaptive neural fuzzy inference system (ANFIS), based on concepts such as fuzzy logic, optimization techniques. This approach is carried out in order to remove a control constraint relating to the need to have a model as faithful as possible, knowing that the modeling errors and the imperfections of the models, contribute to significantly degrade the performance of the conventional control laws [10].

Section 3 presents the mathematical formalism appropriate to the compensatory neural fuzzy inference system controller proposed. The effectiveness of the proposed control is highlighted by some simulation results in Section 4. Finally this paper is concluded with a summary and an outlook to future research directions in Section 5.


2. Presentation of adaptive neural fuzzy inference system (ANFIS)

Jang was the first to present ANFIS as a multi-layer adaptive network-based fuzzy inference system [11]. One can compare this method to a fuzzy inference system besides that it uses back- propagation in minimizing the errors. The operation of a FIS is similar to that of both fuzzy logic (FL) and artificial neural networks (ANN). ln both (ANN) and (FL), the input passes through the input layer (via the input membership function) and the output appears in output layer (via the output membership function). This type of advanced fuzzy logic uses neural networks. Hence, a learning algorithm can be used to change the parameters until an optimal solution is found. It follows that ANFIS uses either back-propagation or a combination of least squares estimation and back-propagation to estimate the membership function parameters [12]. Neural-Fuzzy system has newly known more attraction in research communities than other types of fuzzy expert systems. The reason of it combines the advantages of learning ability of neural network and reasoning ability of fuzzy logic to successfully solve many non-linear and complex real-world problems [13].

The regulator ANFIS is computationally very efficient, as it favors mathematical analysis, and works well with linear, adaptive, and optimization techniques. The fuzzy reasoning is performed with operators min and prod [14].

The conclusions of fuzzy rules are numeric values calculated from the inputs, so the final value is obtained by performing a weighted average of the conclusions [15, 16].

To simplify understanding and without loss of generalities, let us consider a fuzzy regulator with two inputs e1 and e2and one outputu. The entry x1 is associated with two fuzzy sets A1 and A2. As for the two fuzzy sets associated with the second entry x2 are B1 and B2. The output u is modeled by a fuzzy Sugeno-type system, composed of the following four rules [17]:


Let us denote Ok,i the node in the ith position of the kth layer. The node functions in the same layer are of the same function family as defined below.

The input layer is denoted Layer 1 and any node i in this layer is a square node with a node function that describes the membership function. Hence O1,i is the membership function ofAi, and it specifies the degree to which a given variable x satisfies its quantifierAi. We select the membership function in such a way the maximum of which is equal to unity and the minimum equal to zero.

The structure of the regulator ANFIS is given by the following figure (Figure 1):

Figure 1.

Structure of the regulator ANFIS.

Through this structure we can see five layers described as follows:

Layer 1: The function of node at this layer is identical to the membership function in the fuzzification process:

Layer 2: generate the degree of activation of a rule.


Layer 3: Each node of this layer is a circular node denoted by N. The output node represents the normalized activation degree according to the ith rule.


Layer 4: Each node of this layer is a square node with a function described as follows:


where vi is the output of the node I of layer 3 and aibici is the set of update parameters.

Layer 5: In this layer, there is only one node that determines the overall output by using the following expression:


Considering x1and x2 are the position error eand its derivative e: x1x2=ee. We associate two fuzzy sets for each of the inputs x1and x2 namely N (Negative) and P (Positive). μN and μP represent the degrees of membership appropriate to variables xi with respect to the fuzzy subsets Ai and Bi, defined by the following membership functions (Figure 2) [17]:

Figure 2.

Membership functions.


2.1 Learning algorithm

The learning process consists of identifying the consequence parameters ai,bi and ci for i = 1,2,….4. Thus, let us assume yd and y are respectively the desired and actual outputs of system. In this work, we consider that the consequence parameters are adjusted by the minimization of the following objective function:


where e=ydy.

In addition, let be Φi the vector of parameters to be adjusted. Our objective is to find the parameters ai,biand ci of the vector Φi using the gradient descent method combined with the approach of extended Kalman filter. This is equivalent to writing:


We have:


From Eqs. (12) and (13), it follows:


In our case, yu cannot be evaluated, but can be estimated using the extended Kalman filter equations. Consequently, Eq. (14) can be written as:




The Eq. (15) can be identified to extended Kalman filter equation:


Where Kk is the Kalman gain defined as follows:


Where Hk is the Jacobian matrix (observation matrix of the system); Pk is the covariance estimation matrix of the error and is the covariance matrix of the process noise.

Taking Hk=ΨiT,Pk=λ1and Rk=λ2, the gain Kk can be written:


Hence Eq. (18) reduces:


By identification between Eqs. (15) and (21), we have:


Finally, the vector of consequence parameters Φi can be adjusted by the following relation:


2.2 Stability analysis of the control system

From Eq. (23), we can consider for a very short time Te, this relation:


Where K1=KTe



Where eu=K1e is the error between the controller’s desired output ud and actual output u.

Let be Φi=ΦidΦi, where Φi is the vector of the consequence parameters and Φid the vector of the desired consequence parameters.


For linear variation, the error eu is defined by [18]:


Consider the following Lyapunov function [19, 20, 21]:


Differentiating V with respect to time yields, we obtain [17]:


From Eqs. (26), (27) and (29), we obtain:


Consequently, from Eq. (30), we find that V̇0, so we conclude that the system is asymptotically stable in the sense of Lyapunov according to the LaSalle theorem.


3. Compensatory adaptive neural fuzzy inference system (CANFIS)

The other class of inference systems that can deal this type of analytic information in conclusion of rules inference was proposed by Sugeno and his staff.

As for our contribution here, it consists in adding a compensatory fuzzy part to adjust consequence parameters and as well to dynamically optimize the adaptive fuzzy reasoning. In addition to this, ANFIS represents a class of adaptive networks that are functionally equivalent to a first order Takagi-Sugeno fuzzy model. As performed above, by taking a center-average deffuzzifier mapping, the crisp value of the output u is given as:


We consider the pessimistic and optimistic operation given respectively as follows:


By using these two operations, our contribution is to add the compensatory form formulated as [7]:


Where γiϵ01 is compensatory degree. Finally, the crisp value of the compensatory neural-fuzzy inference is derived as [13, 14]:


For simplicity, we define:


Then we have:


The structure of the CANFIS controller with compensatory fuzzy for two input and one output, is shown by Figure 3 [9].

Figure 3.

Structure of CANFIS controller.

3.1 Learning algorithm

Consider as for ANFIS two dimensional data vectors, x=ee and one dimensional output data vectoru2. In order to limit the computation time, we have optimally adjusted the consequence parameters and compensatory degree by minimizing the following objective function:


Where yd and y are respectively desired and actual values of output system. Now let Φ2i for i = 1….4, be the vector of update parameters. We aim to determine vector Φ2i through the extended Kalman filter which consists in linearizing the output around the control input at each sampling period. This is equivalent to writing [16, 19, 20]:


In which


Where λ1 and λ2 are adaptation gains for varying the convergence rate. Further, to eliminate the constraintγi01, we redefine γi as follows [7]:


Where pi and ri are update parameters such that γi01. Consequently, the vector of update parameters is given as Φ2iT=aibicipiri for CANFIS. According to the definition, we have [17]:


Finally, the vector of parameters Φ2i is adjusted using the following equation:


Where Ψ2iT=u2aiu2biu2ciu2piu2ri.

3.2 Stability analysis of the control system

From Eq. (48), we can consider for a very short time Te, this relation:


Where K1=KTe



Where eu=K1e is the error between the controller’s desired output ud and actual output u.

Let be Φ2i=Φ2idΦ2i, where Φ2i is the vector of the consequence parameters and Φ2id the vector of the desired consequence parameters.


For linear variation, the error eu is defined by:


Consider the following Lyapunov function:


Differentiating V with respect to time yields, we obtain:


From Eqs. (51), (52) and (54), we obtain:


Consequently, from Eq. (55), we find that V̇0, so we conclude that the system is asymptotically stable in the sense of Lyapunov according to the LaSalle theorem.


4. Simulation results and interpretation

We applied in simulation the neural-fuzzy command equipped with a compensator explained above, to the two-joint robot in a performance environment described by the following joint trajectories:


With i=1.2.

The compact form of the dynamic model relating to the two-joint robot is given as follows:



q=q1q2: Vector of joint position variables.

q̇=q̇1q̇2: Vector of joint velocity variables.

q¨=q¨1q¨2: Vector of joint acceleration variables.

τ=τ1τ2: Vector of torques applied to joint.

Mq: Inertial matrix.

Cqq̇: Matrix of terms centripetal and coriolis.

Gq: Vector of gravitational effects


The parameters relating to the dynamic model of this robot are given in the following table (Table 1):

Mass of the link 1 m16.5225kg
Mass of the link 2 m22.0458kg
Link length 1 l10.26m
Link length 2 l20.26m
Gravity g9.81m/s2
Distance to the center of mass of link 1 lc10.0983m
Distance to the center of mass of link 2 lc20.0229m
Moment of inertia of the center of mass m10.1213kg.m2
Moment of inertia of the center of mass m20.0116kg.m2

Table 1.

Robot parameters.

Figures 4 and 5 show the time evolution position and velocity errors and the torque applied to each joint of manipulator Robot with neuro-fuzzy controller and neuro-fuzzy controller respectively. Through these graphics, we can see that, the Neural –fuzzy controllers and compensatory Neural-fuzzy controllers provide a good tracking performance.

Figure 4.

Motion errors tracking and torques behavior with neural-fuzzy without disturbances.

Figure 5.

Motion errors tracking and torques behavior with compensatory neural-fuzzy with without disturbances.

On the one hand, we can observe that the tracking errors are limited by low values, and the dynamics of the errors in position vary little compared to that of the errors in speed. This is physically explained by the fact that the position depends only on the environment while the velocity in addition to the environment depends on the Jacobean matrix. On the other hand, the command paths are smooth, which facilitates their implementation. This is achieved through the appropriate choice of parameters of the control structures.

In order to test the capacity of adaptation and robustness of the proposed approach, we have added in our simulation at time t=5sthe combined friction and external torque disturbance for each joint, given as follows.


The results obtained are illustrated by Figures 6 and 7, where we note that the tracking errors show peaks especially at the moment of the introduction of the disturbances, which are rejected quickly, by the Neural – fuzzy controllers and Compensatory Neural-fuzzy structure of the regulator, which allows to conclude that the tracking performance is very little affected by these disturbances. This is due to the low sensitivity to disturbance of the input data of the proposed control strategy.

Figure 6.

Motion errors tracking and torques behavior with neural –fuzzy with disturbances.

Figure 7.

Motion errors tracking and torques behavior with compensatory neural –fuzzy with disturbances.


5. Conclusion

In this chapter, we have proposed and presented a control strategy based on a neuro-fuzzy inference system regulator with a fuzzy compensator to control the manipulator robot with two joints.

It is important to note that the compensatory neural fuzzy inference system is more powerful than fuzzy systems or neural networks, since it can incorporate these advantages:

  • Adaptive fuzzy reasoning method using fuzzy compensator can make the fuzzy system adaptive and efficient more.

  • The neuro-fuzzy compensation system tolerates errors, because it is effective regardless of the choice of initial fuzzy rules (good or bad) for learning.

  • The speed of convergence of the learning algorithm is faster than that of the back propagation algorithm.

  • The learning algorithm not only adjusts membership functions, but also optimizes the dynamics of fuzzy reasoning by adjusting the degree of compensation. As a result, fuzzy neuro systems with a fuzzy compensator are more efficient than conventional neuro-fuzzy systems.

This control strategy has the advantage of requiring only measurements of output variables. The simulations indicate that a complete stabilization of the system is indeed observed.

In conclusion, we wanted, at the end of this chapter, to try to identify a broad-spectrum methodology that opens the field to a possible standardization of the design of control laws based on a neuro-fuzzy structure equipped with a compensator, in order to controlling a poorly understood and imprecise dynamic system. It would be interesting in the context of experimental tests to judge the performance of the methods proposed on real systems.


  1. 1. JYH-SHING R., CHUEN-TSAI S., “Neuro-Fuzzy Modeling and Control” Procedings of the IEEE, Vol. 83, N0 3, March 1995 pp. 378–404.
  2. 2. S. Ghosh, M. Majumder. “Prediction of Wave Energy Potential in India: a Fuzzy–ANN Approach.” Intech-2019, DOI:
  3. 3. S.D. Nguyen. “ANFIS: Establishing and Applying to Managing Online Damage.” Intech-2019, DOI:
  4. 4. B. Ergün, C. Sahin and U. Kaplan. “ANFIS Definition of Focal Length for Zoom Lens Via Fuzzy Logic Functions.” Intechopen-2017, DOI:
  5. 5. L. Moradi and R. Ehtehamrasi. “ANFIS to Quantify Maintenance Cost of IT Services in Telecommunication Company.” Intechopen-2020, DOI:
  6. 6. HAO Y. “Constructing Nonlinear Variable Gain Controllers via the Takagi - Sugeno Fuzzy Control.” IEEE Transactions on Fuzzy Systems, Vol. 6, No. 2, May 1998, pp. 226–234.
  7. 7. YAN-QING., ABRAHIM K., “Compensatory Neurofuzzy Systems with Fast Learning Algorithms.” IEEE Transactions On Neural Networks, Vol. 9, N0 1, January 1998 pp. 83–105.
  8. 8. BYUNG K., WOON C. H., “Adapive Control of Robot Manipulator Using Fuzzy Compensator.” IEEE Transactions on Fuzzy Systems, Vol. 8, No. 2, April 2000.
  9. 9. R. Mellah, S. Guermah, and R. Toumi. “Adaptive control of bilateral teleoperation system with compensatory neural fuzzy controllers.” International Journal of Control, Automation and Systems, vol. 15, no. 4, pp. 1949–1959, 2017.
  10. 10. R. Mellah and R. Toumi, “Compensatory neuro-fuzzy control of bilateral teleoperation system,” Proc. of 20th Internationale Conference on Methods and Models in Automation an Robotic, 24–27 August 2015, Miedzyzdroje, Poland, pp. 382–387.
  11. 11. J. R. Jang. “ANFIS: adaptive-network based fuzzy inference system.” IEEE Transactions on Systems, Man and Cybernetics N° 23, vol. 13 pp 665–685, 1993.
  12. 12. S. R. Jang and C. T. Sun. “Neuro-fuzzy and Soft Computing: A Computational Approach to Learning and Machine Intelligence.” Prentice Hall, Englewood Cliffs, NJ, 1997.
  13. 13. M. N. M. Salleh, N. Talpur and K. H. Talpur. “A Modified Neuro-Fuzzy System Using Metaheuristic Approach for Data classification.” Intechopen-2018, DOI:
  14. 14. KARAKASOGLU A., SUNDARESHAN M., “A Recurrent Network-based Adaptive Variable structure Model- following Control of Robotic Manipulators.” Automatica, Vol. 31, N0 10, pp. 1495–1507, 1995.
  15. 15. YIH-GUANG L., WEI-YEN W., TSU-TIAN L., “Robust Adaptive Fuzzy-Neural Controllers for Uncertain Nonlinear Systems” IEEE Transactions on Robotics and Automation, Vol. 15, No. 5 Oct 1999.
  16. 16. JEAN B. M., “Robust Neuro-Fuzzy Sensor-Based Motion Control Among Dynamic Obstacles for Robot Manipulators.” IEEE Transactions on Fuzzy Systems, Vol. 11, NO. 2, April 2003, pp. 249–261.
  17. 17. MENG J., “Robust Adaptive Control of Robot Manipulators Using Generalized Fuzzy Neural Networks.” IEEE on Industrial Electronics, Vol. 50, N°. 3, June 2003.
  18. 18. R. Mellah and R. Toumi, “Control bilateral teleoperation by compensatory ANFIS,” Advanced Mechatronics Solutions, vol. 393, pp. 167–172, 2016.
  19. 19. LIMIN P., PENG-YUNG W., “Neural-Fuzzy Control System for Robotic Manipulators.” IEEE Control Systems Magazine, February 2002. pp. 53–63
  20. 20. H Khati, R Mellah, H Talem. “Neuro-fuzzy Control of a Position-Position Teleoperation System Using FPGA.” 24th International Conference on Methods and Models in Automation and Robotics, 26–29 August 2019, Miedzyzdroje, Poland, pp. 64–69.
  21. 21. H Khati, H Talem, R Mellah, A Bilek. “Neuro-fuzzy control of bilateral teleoperation system using FPGA.” Iranian Journal of Fuzzy Systems vol. 16, N°. 6, pp. 17–32, 2019.

Written By

Rabah Mellah, Hocine Khati, Hand Talem and Said Guermah

Submitted: 18 November 2020 Reviewed: 16 January 2021 Published: 15 February 2021