# Inducing Optimality in Prescribed Performance Control for Uncertain Euler-Lagrange Systems
## 5 Simulation Results
### Case A: Pendulum  
Consider a pendulum that obeys the following Euler-Lagrange dynamics  
\[\dot{q}=-\frac{g}{l}sin(q)-\frac{k}{m}\dot{q}+\frac{1}{ml^{2}}\tau \tag{25}\]  
with \(q\) and \(\dot{q}\) denoting the angular position and velocity, respectively, and \(\tau\) denoting the applied torque that acts as the system's input. In addition, \(m\) denotes the mass and \(l\) the length of the rod, with \(k\) being the friction coefficient and \(g\) the acceleration of gravity. The values that were adopted for the simulation are \(m=5.2\) kg, \(l=0.9\) m, \(k=1\) kg/s, and \(g=9.81\) m/s\({}^{2}\). Despite its simplicity, several systems are modeled by equations similar to (25), rendering it of great practical importance. Initially, a reference trajectory was designed so that it traversed (in random order) 51 points scattered over the domain set \(\Omega_{q}\times\Omega_{q}=[-1,1]\times[-1,1]\). The gains of the PPC controller used to track it were \(k=2\) and \(\lambda=7\), with performance specifications dictated by \(\rho_{0}=\pi/3\), \(\rho_{\infty}=\pi/180\), and \(l=1.5\). Finally, the gains of the tracking differentiator were chosen as \(k_{z_{1}}=k_{z_{2}}=0.2\) and \(R=100\). We also employed a neural network with a hidden layer containing eight neurons, to extract the system dynamics via the learning process. The neural network's training was carried out for 20 iterations (i.e., 20 permutations of the overall 51 points in the workspace), so that the approximation improved sufficiently. The training of the adopted neural network structure over the collected data during each iteration (i.e., after each one of the 20 reference trajectories) was conducted using the MATLAB toolbox employing the default Levenberg-Marquardt algorithm. The results of the approximation problem can be observed in Figure 2 for the corresponding terms of \(f(q,q)\) and \(g(q)\). It can be easily observed that through this process, we succeeded in obtaining a highly accurate (with an average relative approximation error less than 1%) estimate of the system dynamics, without relying on any prior knowledge. In the second phase, we set a conventional PPC stabilizing controller, parametrized by \(k=2\), \(\lambda=2\), \(\rho_{0}=\pi/3\), \(\rho_{\infty}=\pi/180\) and \(l=1.5\), as the initial admissible control policy. Our aim was to drive the system towards the fixed configuration \(\bar{q}_{d}=0.5\), which is not a zero-input equilibrium of the system. The points used for the regression process were sampled from the set \(\Omega_{q,\rho,\epsilon}=\left\{ \begin{bmatrix}0&1\end{bmatrix} \times\left[ \rho_{\infty}&10\rho_{\infty}\right]\right\}\times\left[-0.45&0.45\right]\). Please note that the values chosen for the PPC controller, as well as the set adopted for the regression process should be specifically picked to take into consideration the desired prescribed performance specifications, as well as the system's region of operation, respectively. For the integral cost, the weights \(\alpha=0.5\) and \(\beta=0.5\) were chosen to specify an equal trade-off between the error convergence and the requested input energy. Moreover, \(P=2500\) points were chosen within \(\Omega_{q,\rho,\epsilon}\), and the number of constraints was set to \(M=1250\). The cost function was approximated by 32 polynomial basis functions, chosen as follows: \(\sigma(q,\rho,\epsilon)=\left[T_{i_{1}}(q)T_{i_{2}}(\epsilon)T_{i_{3}}(\rho) \right]_{i_{1},\;i_{2}=\{1...A\}}\) & \(i_{j=\{1,2\}}\), where \(T_{i}(\cdot)\) denotes the Chebyshev polynomial of degree \(i\). An important property of these polynomials is that they are orthogonal with respect to the inner product, rendering them ideal for performing polynomial regression. The response of the system under the optimal policy was simulated for 3 s for five different initial conditions and is illustrated in Figure 3, where the ability of the algorithm to stabilize the system under strict performance specifications is demonstrated.