## 5 Simulations and Analysis in Battlefields  
### The Procedure of Matlab Simulations of UAV Formations in Battlefields  
To evaluate the survival rate of a formation based on the 3 \(\times\) 3 magic square and the chain rules of visual reference in battlefields, we used matlab to simulate the attacks on UAV formation in battlefields. There are six premises of the simulation experiments. First, different-scale UAV clusters will enter the enemy region and will be attacked after the formation. Second, once the grid formation is completed, all UAVs' plane height, speed, and relative distance will remain unchanged until they reach the destination. Third, each fire attack on UAVs has a random aim and is completed once it is exerted. The number of UAVs to be destroyed can be set before simulation. Fourth, UAVs out of the formation are those which lose all reference planes in the grid formation. Fifth, surviving UAVs are those which are not destroyed and for which there is at least one reference UAV. Sixth, the UAV  
Figure 24: Regenerated topological structure diagram of 7 \(\times\) 7 nested magic squares formation. clusters will not defend or dodge, so the stability of the formation in worst-case scenarios can be obtained. Figure 25 is the flow chart of the detailed simulation. Although the number of drones set to be destroyed is the same, there will be some variation in the number of drones out of formation as the aimed destructed areas were randomly set. For this reason, the simulation experiments were conducted 100 times with the same fight loss for the same-scale formation to obtain the average values of the UAVs which were out of formation and those which survived. Next, this study simulated the \(3\times 3\) to \(83\times 83\) grid formations and calculated the number of UAVs out of formation and surviving UAVs at 85% fight loss. ### The Procedure of Matlab Simulations of UAV Formations in Battlefields  
To test and verify the survival rate of formations with nested magic square topological structures based on the \(3\times 3\) magic square and the chain rules of visual reference in battlefields, we adopted matlab simulations to obtain the regression curve of UAVs out of the formation and surviving UAVs in different-scale formations with the fight loss set at 85%. These values can be expressed in the following equation:  
\[H_{n}=M_{n}-D_{n}-Is_{o} \tag{17}\]  
where \(H_{n}\) is the remaining UAVs, \(M_{n}\) refers to the UAVs before entering the battlefield, \(D_{n}\) represents the total destructed UAVs, and \(Is_{o}\) stands for the undestroyed UAVs that get out of formation. The simulation results are as shown in Table 3 and Figure 26.  
Figure 25: Flow chart of simulation experiments of attacking the UAV formation in battlefields. The least square method was adopted to make the curve fitting simulations of UAVs out of clusters and surviving UAVs clusters with 85% fight loss, and the results are as shown in Figures 27 and 28. \begin{table}
\begin{tabular}{c c c} \hline \hline
**UAV Formation** & **UAVs Out of** & **Surviving UAV** \\
**Scale (Planes)** & **Clusters (Planes)** & **Clusters (Planes)** \\ \hline  
\hline \hline \end{tabular}
\end{table} 
Table 3: Simulation results of UAV formations with 85% fight loss. Figure 26: UAVs out of clusters and surviving UAVs in different-scale formations with the fight loss set at 85%. The regression model equation of UAVs out of clusters can be expressed as:  
\[R_{a}=0.0512M_{n}+1.1267 \tag{18}\]  
where \(R_{a}\) is the number of UAVs out of clusters, and \(M_{n}\) refers to the number of clusters. According to the simulation results, the 95% confidence interval of gradients in the curve model was [0.0510, 0.0515], and that of intercepts was [0.3620, 1.8914], so the intercepts and gradients of the regression model curve equation satisfied the requirement. The R2 variance explained rate was 0.9999, proving the significance test of the regression equation with excellent fitting.