## 3 The Design of the EKF Algorithm
### Simulation Verification  
In order to verify the accuracy of the parameter identification values obtained by the EKF algorithm, the identified parameters are substituted into the second-order nonlinear Nomoto model. The same rudder angle as the real vessel data is used as the input, and the simulated heading angle and heading rate data are obtained for comparison. The results are shown in Figures 6-13: \begin{table}
\begin{tabular}{c c c c} \hline
**Parameter** & **Value** & **Parameter** & **Value** \\ \hline \(K\) & 0.5770 & \(T_{1}\) & 2.5384 \\ \(\delta_{r}\) & 0.0137 & \(T_{2}\) & 0.7097 \\ \(a\) & 61.7745 & \(T_{3}\) & 0.9460 \\ \hline \end{tabular}
\end{table} 
Table 2: EKF parameter identification results. Figure 4: Filtering effect of heading angular velocity data (Case 2). Figure 5: Filtering effect of rudder angle data (Case 2). Figure 8: Prediction results of heading angular velocity (Case 1). Figure 6: Prediction results of heading angle (Case 1). Figure 7: Prediction errors of heading angle (Case 1). Figure 9: Prediction errors of heading angular velocity (Case 1). the predicted curves for heading angle and heading rate closely match the experimental data. As shown in Figures 7 and 11, the prediction errors for the heading angle remain within 18\({}^{\circ}\), and in Figures 9 and 13, the prediction errors for the heading rate stay within 8\({}^{\circ}\)/s. This demonstrates that the parameters identified by the EKF algorithm are highly accurate, with excellent modeling precision. To more clearly demonstrate the accuracy of the identification and modeling performed by the EKF algorithm, the MAE and the R\({}^{2}\) are introduced as evaluation metrics for algorithm precision [23]. The calculation formulas are given as follows:  
\[\left\{\begin{array}{l}\mathrm{MAE}=\sum\limits_{i=1}^{n}{{{{\left|{{y_{i}}-{ \hat{y}_{i}}}\right|}}/{n}}}\\ \mathrm{R}^{2}=1-[\sum\limits_{i=1}^  
The calculated MAE and R\({}^{2}\) values are shown in Table 5 and Figure 20: MAE and R\({}^{2}\) values calculation results (Case 3). As can be seen from Figures 16 and 18, the forecasted curves of the heading angle and heading rate are well fitted. And it can be observed from Figures 15 and 17 that the prediction error of the EKF is smaller than that of the RLS. From the calculation results in Table 5, it can be observed that the MAE indicator of the forecasted heading angle is within  
Figure 19: Prediction errors of heading angular velocity (Case 3). Figure 20: Calculation results (Case 3). (**a**) with MAE; (**b**) with R\({}^{2}\). \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & \multicolumn{2}{c}{\(\psi\)} & \multicolumn{2}{c}{\(r\)} \\
**Value** & **RLS** & **EKF** & **RLS** & **EKF** \\ \hline MAE & 9.8304 & 9.3364 & 0.7595 & 0.7369 \\ R\({}^{2}\) & 0.920 & 0.935 & 0.970 & 0.974 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: MAE and R\({}^{2}\) values calculation results (Case 3). 9.5\({}^{\circ}\), the MAE indicator of the forecasted heading rate is within 0.74\({}^{\circ}\)/s, and the R\({}^{2}\) values of the forecasted heading angle and heading rate are both above 0.93. However, the MAE indicator of the forecasted heading angle is over 9.8\({}^{\circ}\), the MAE indicator of the forecasted heading rate is over 0.75\({}^{\circ}\), and the R\({}^{2}\) values of the forecasted heading angle are below 0.93, as shown in Figure 20. Compared to the RLS algorithm, the heading angle MAE values are improved by 5.03% with the EKF-based approach, while the heading rate values are improved by 3.0%. These results demonstrate that the EKF algorithm outperforms the RLS algorithm, as the USV Nomoto model established using the EKF algorithm achieves higher accuracy in forecasting both the heading angle and heading rate. Furthermore, the EKF algorithm exhibits strong generalization ability. To further help understand the robustness of the model, this paper sets the bow angle error to 17\({}^{\circ}\) and the bow angular velocity error to 2\({}^{\circ}\)/s as confidence intervals.