## 4 Simulation Results
### Example 2  
For the second Example, considering four followers and one leader in a formation, the control rule in Equation (44) has been simulated. In this case using a hyperbolic tangent function that is a bounded function, we expect that input controllers remain bounded. In Example 1, due to irregularity and the discontinuity of saturation function, the oscillations in the input torques are severe. However, in the second simulation, due to the hyperbolic tangent function that is smooth and continuous, in addition to the constraint of the control signals, the discontinuities in the input controls intensity decreased.  
Desired values of relative distance and relative bearing for each follower are as follows:  
\[\begin{array}{l}q_{1d}=\begin{bmatrix}3.5,\frac{\pi}{3}\end{bmatrix}^{T},q_ {2d}=\begin{bmatrix}3.5,-\frac{\pi}{3}\end{bmatrix}^{T}\\ q_{3d}=\begin{bmatrix}1.5,\frac{\pi}{3}\end{bmatrix}^{T},q_{4d}=\begin{bmatrix} 1.5,-\frac{\pi}{3}\end{bmatrix}^{T}\end{array} \tag{74}\]  
The control parameters for all of followers are as below:  
\[\begin{array}{l}K_{pi}=\begin{bmatrix}25&0\\ 0&25\end{bmatrix};K_{i\
u}=\begin{bmatrix}10&0\\ 0&10\end{bmatrix};\\ \delta_{\theta_{i}}=0.0001,i=1,\dots,4\end{array} \tag{75}\]  
\[\Lambda_{pi}=\begin{bmatrix}0.25&0\\ 0&2.5\end{bmatrix},\gamma_{di}=1 \tag{76}\]  
\[\Gamma_{\theta_{i}}=\text{diag}(10,10,10,0.1),i=1,\dots,4 \tag{77}\]  
The initial value of parameters in estimation is considered as below:  
\[\hat{\theta}_{i}=[1,3,2,1]^{T},i=1,2,\dots 4 \tag{78}\]  
In this case, simulation results are shown in the Figures 10-15.  
As it is shown in Figure 10, relative errors for all four followers goes to zero; this confirms the effectiveness of the controller for keeping leader-follower formation. Although a steady-state error can be seen at the end of the convergence. The trajectories of ASVs in the formation are shown in Figure 11 that confirms leader-follower formation.  
Figure 9: Estimated value of the vector \(\hat{\theta}_{i}\).  
In this case, we expect that discontinuity in the control input is less than as for the first simulation. To illustrate this, the control input of the first follower is shown in Figure 11. The oscillation and discontinuity in much less in comparison with previous simulations where the only function saturation was used. Indeed, function tanh that is used in the controller (44), unlike the saturation function, is a continuous function and as expected, acted well in reducing the amount of discontinuity and chattering. Torque inputs are shown for each of the four follower vessels in Figures 12-15.  
Figure 11: Leader-follower trajectories in Example 2.  
Figure 10: Relative distance and relative bearing errors of followers in Example 2.  
Figure 14: Applied input control of the third follower in Example 2.  
Figure 12: Applied input control of the first follower in Example 2.  
Figure 13: Applied input control of the second follower in Example 2.  
As seen from these figures, the volatility and discontinuity were much lower than the simulation of the previous section, where only one saturation function was used. Indeed, the hyperbolic tangent function used in contrast to the controller (44) is in contrast to the functional saturation function and, as we have anticipated, worked well to reduce the amount of discontinuity or chattering. In Figure 16, the hyperpolecular tangent function \((\tanh(e_{i}))\) and \((\ln(\cosh e_{i}))\) function are plotted in terms of a function of error.  
Figure 17 shows the estimated vector \(\hat{\alpha}_{i}=\left[\hat{\delta}_{0},\hat{\delta}_{1},\hat{\delta}_{2} \right]^{T}\), \(i=1,2,\ldots 4\) parameters for each follower in the leader-follower formation.  
Figure 16: Hyperbolic tangent function and its derivative in error \(e_{i}\).  
Figure 15: Applied input control of the fourth follower in Example 2.