## 3 Secure Rate Maximization Scheme
### K-Means Cluster Pair Algorithm
Secondly, given the three initial values (channel, power, and height) \(\mathbf{A}^{(0)},\mathbf{P}^{(0)}\) and \(\mathbf{H}^{(0)}\), the BCD algorithm is used to decompose the original problem P2 into three subproblems (channel allocation, power optimization and height optimization), each of them is optimized with the remaining two variables fixed. After that, the result of the first iteration is used as the initial value of the second iteration, and we repeat these successive iterations where the maximum secure rate can be obtained due to its convergence. Finally, the optimal channel allocation \(\mathbf{A}^{*}\), optimal transmit power \(\mathbf{P}^{*}\) and optimal UAVs' height \(\mathbf{H}^{*}\) can be derived. \[\text{s.t.}(8),(9),(10),(11),(12),\]7 Iterative framework of our proposed algorithm. In addition, the convergence of the algorithm is proved as follows. First, we can derive an upper bound of the sum secure rate by a simple scenario. We assume that there is only a single user uploading information whose maximum secure rate is \(r^{\text{sec}}(\mathbf{H}^{*},\mathbf{P}^{*})\), where the optimal UAV's altitude (\(\mathbf{H}^{*}\)) and users' power (\(\mathbf{P}^{*}\)) can be obtained by the enumeration method. Then the upper sum sesure rate of an HAP and \(A\) UAVs where \(N\) users are presented in the coverage area of each UAV is \(R^{\text{upper}}=A\times N\times r^{\text{sec}}(\mathbf{H}^{*},\mathbf{P}^{*})\). Therefore, due to the limited users' power and spectrum bandwidth, our proposed algorithm will gradually converge at the end. Moreover, we consider the convergence is achieved when the difference between the sum secure rate of the \((l+1)\)-th iteration and the \(l\)-th iteration is less than \(10^{-5}\). ## 4 Simulation Experiments

Numerical results are used to verify the effectiveness of the proposed algorithm in this section. ### Initialization

It is assumed that all users are randomly distributed whose amount is 40. More detailed parameters are given in Table 2, and their initial settings are as follows: channel \(\mathbf{A}\) is assigned randomly, power \(\mathbf{P}\) is taken as the maximum value, and the height of the UAV \(\mathbf{H}\) is the middle value between the HAP and users. ### Numerical Results

In Figure 3, the optimized positions of UAVs are depicted. To more clearly show the user allocation, the top view of cluster 3 is enlarged. We use the K-means algorithm to divide users into four clusters, with the UAV located at the center of each group to better receive information. Meantime, a distant user and an adjacent one compose a NOMA pair and share the same subcarrier. From Figure 3, we can clearly observe that the UAV tends to be closer to ground users and keeps away from the HAP to achieve a higher total secure rate. In order to verify the effectiveness of our proposed algorithm, we compared it with the following five algorithms: constant power, constant height, NOMA-relevant [13], NOMA-random, and orthogonal frequency division multiple access (OFDMA). In the constant power scheme, all of the users transmit data at maximum power \(P_{x}\) = 1 Watt. In the constant height scheme, all of the UAVs hover at the same height \(H_{u}\) = 150 m. In the NOMA-relevant scheme, the clusters of users employ NOMA only when it is beneficial for all of them in terms of their individual rates, otherwise the OMA technique is selected. In the NOMA-random scheme, users pair and select spectrum randomly, and in the OFDMA scheme, each user accesses a subchannel independently. \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline Number of UAVs, \(M\) & 4 \\ Number of channels, \(K\) & 5 \\ Bandwidth of each user, \(B\) & 180 kHZ \\ Carrier frequency & 2.1 GHz \\ Coordinates of HAP & \([500,500,950]\) \\ Coordinates of EVE & \([400,800,500]\) \\ \(h_{\min}\) and \(h_{\max}\) of UAVs & \(50/500\) m \\ \(P_{\min}\) and \(P_{\max}\) of users & \(0.1/1\) W \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Simulation Parameters.