# A Data-Driven Approach of Takagi-Sugeno Fuzzy Control of Unknown Nonlinear Systems
## 5 Application Example
500 testing data that are different from the training data are used to test the accuracy of the neuro-fuzzy model and the subsequent T-S fuzzy models. The T-S fuzzy models in this paper are all constructed with triangular membership functions due to their simplicity. To determine the proper number of operating points for linearization, the grade of the nonlinearity of each state variable is evaluated as follows: first, the system is linearized at the equilibrium point \(\mathbf{x=0}\), where the result is \(\mathbf{A_{x=0}}\). Then by randomly changing one state variable \(x_{i}\) in the operating range and fix all the other state variables, a series of matrices \(\mathbf{A_{xi}}\) are obtained. They are compared to \(\mathbf{A_{x=0}}\) in terms of the 2-norm of difference. The results are summarized in Table 2. The idea is that if the state variable \(x_{i}\) is linear or affine in the system, then identical \(\mathbf{A}\) matrices should be obtained at different positions of \(x_{i}\). Otherwise, \(x_{i}\) should be regarded as nonlinear. From Table 2, it can be seen that the variables \(\theta_{2}\), \(\dot{\theta}_{1}\) and \(\dot{\theta}_{2}\) are sources of nonlinearity around the origin, among which \(\theta_{2}\) is the most significant one. The other variables can be treated as linear. Two sets of operating points are selected for comparison: the first set consists of 27 points based on the combination of uniformly chosen positions \(\theta_{2}\) = [\(-\)0.7, 0, 0.7] (_rad_), \(\dot{\theta}_{1}\) = [\(-\)1.0, 0, 1.0] (_rad_/s) and \(\dot{\theta}_{2}\) = [\(-\)1.0, 0, 1.0] (_rad_/s); the second set consists of only 12 points, the positions are chosen by the ES optimization: \(\theta_{2}\) = [\(-\)0.9575, \(-\)0.0181, 0.9479] (_rad_), \(\dot{\theta}_{1}\) = [\(-\)0.9034, 0.5891] (_rad_/s) and \(\dot{\theta}_{2}\) = [\(-\)1.5, 1.5] (_rad_/s). \(\theta_{2}\) is assigned three positions while the other two are assigned only two positions as \(\theta_{2}\) is the most significant source of nonlinearity according to Table 2.  
In Figure 5, it can be seen that the outputs predicted by the T-S fuzzy models are very close to the testing experimental data. The NDEIs of the neuro-fuzzy model and the two T-S fuzzy models, which are used as the criteria of global approximation, are listed in Table 3. It can be seen that the T-S fuzzy models derived from the neuro-fuzzy model can provide an accurate approximation of the original nonlinear system. The 12 points T-S fuzzy model with optimized operating points gives an even better approximation than the 27 points one with uniformly distributed operating points. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \(x_{i}\) & \(\theta_{1}\) & \(\theta_{2}\) & \(\theta_{3}\) & \(\theta_{4}\) & \(\theta_{1\text{dot}}\) & \(\theta_{2\text{dot}}\) & \(\theta_{3\text{dot}}\) & \(\theta_{4\text{dot}}\) \\ \hline mean\(\|\mathbf{A_{x_{i}}}-\mathbf{A_{x=0}}\|\) & 0 & 85.89 & 0 & 0 & 3.67 & 9.13 & 0 & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Inspection of the source of nonlinearity. Figure 4: Sine sweep signals to motors. To test the controller performance, the reference commands to be tracked are given by  
\[r_{\theta_{1}}=r_{\theta_{2}}= \begin{cases}0.4t^{2}&t\leq 0.4\\ 0.064+0.32(t-0.4)&0.4<t\leq 1.875\\ 0.6-0.4(t-2.275)^{2}&1.875<t\leq 2.275\\ 0.6&t>2.275\end{cases} . \tag{26}\]  
Because the gear ratio is 5, the command inputs for \(\theta_{3}\) and \(\theta_{4}\) are given by  
\[r_{\theta_{3}}=5r_{\theta_{1}}\quad r_{\theta_{4}}=5r_{\theta_{2}}\enspace. \tag{27}\]  
The command inputs for the angular velocities are  
\[r_{\dot{\theta}_{1}}=r_{\dot{\theta}_{2}}=\left\{ \begin{array}{ccc}0.8t&t \leq 0.4\\ 0.32&0.4<t\leq 1.875\\ -0.8(t-2.275)&1.875<t\leq 2.275\\ 0&t>2.275\end{array} \right. \tag{28}\]  
\[r_{\dot{\theta}_{3}}=5r_{\dot{\theta}_{1}}\quad r_{\dot{\theta}_{4}}=5r_{\dot {\theta}_{2}}\]  
The performance index is defined as:  
\[J=\int_{0}^{4}\left\{