## 4 Numerical Simulations and Analysis
### Trajectory Tracking Analysis
The simulation results, depicted in Figure 3, unequivocally demonstrate the algorithm's effectiveness in achieving accurate trajectory tracking. The red curve in Figure 3 represents the target trajectory,curve illustrates the actual motion trajectory of the AUV with Gaussian-process-based MPC, and the green dotted curve represents the MPC method. The remarkable alignment between these two curves demonstrates the algorithm's ability to steer the AUV precisely along the intended path. To delve deeper into the results, Figure 4 presents a comprehensive view of the tracking outcomes and errors in the \(x\), \(y\), and \(z\) directions over time during the simulation. Figure 4a displays the target and simulated trajectories. Here, the red, blue, and green curves signify the target trajectory in the \(x\), \(y\), and \(z\) directions, respectively. The trajectories in the \(x\), \(y\), and \(z\) directions of Gaussian-process-based MPC trajectories are represented by the red, blue, and green curves, respectively. The yellow, pink and purple dashed curves represent the trajectories of the MPC method. From Figure 4, it is evident that the MPC and Gaussian-process-based MPC can effectively approach the target trajectory when their initial positions differ, and subsequently form a stable tracking effect. It can be observed from the approach curve during the first 20 s shown in subgraph (a) and the error curve of subgraph (b) that Gaussian-process-based MPC can approach the target curve more stably and quickly. After 20 s, the average tracking error of Gaussian-process-based MPC is 0.099 m, while that of MPC is 0.227 m. Overall, the results demonstrate the effectiveness and accuracy of this algorithm in maintaining good trajectory tracking performance. The sinusoidal trajectory presents a complex and dynamic motion pattern, and this type of trajectory can be defined as follows:  
\[\mathbf{y}_{\textit{ref}}= \begin{bmatrix}15\text{cos}\ \underline{\xi}\\ 0.3t\\ \end{bmatrix}  \tag{58}\]  
The initial state of the AUV is defined as \(\mathbf{x}_{0}=[0,0,0,0,0,0,30,15,-15,0,0,0]^{\text{T}}\). Figures 5 and 6, respectively, show the spatial trajectory tracking results and the differences in the \(x\), \(y\), and \(z\) components. After 50 s, the average tracking error of Gaussian-process-based MPC is 0.367 m, while that of MPC is 0.577 m. Overall, the sinusoidal trajectory tracking presents substantial challenges for the AUV due to variations in curvature and speed. Compared to the spiral curve, the tracking error of each control method increases, but can remain within a lower range after stabilization. Figure 4: The tracking results and errors with time during simulation for tracking spiral trajectory. Figure 3: The results of spiral trajectory tracking. In summary, the algorithm has successfully demonstrated its ability to enable the AUV to meticulously track the desired trajectory, as is evident from the close alignment between the actual and desired trajectories. Furthermore, the analysis of tracking errors further confirms the algorithm's capacity to mitigate the initial discrepancies and sustain an accurate tracking throughout the simulation. These findings highlight the algorithm's potential to enhance trajectory control and facilitate the dependable motion of AUVs in real-world scenarios.