# Altitude Optimization and Task Allocation of UAV-Assisted MEC Communication System
## 4 Numerical Results
However, when \(B_{\text{BS}}\) increases, the user offloads more computing tasks to the BS, and the task allocation ratio of offloading to BS \(1-\alpha\) increases, i.e., \(\alpha\) decreases. In the two figures we can also see that \(H^{opt}\) remains constant, since the optimal flight altitude is independent of \(B_{\text{UAV}}\) and \(B_{\text{BS}}\). The correctness of the analytical results can be verified by comparing the results based on Formulas (15) and (18) with the results obtained from the one-dimensional search. In Figures 6 and 7, we plot the minimum system delay, \(H^{opt}\), and \(\alpha^{opt}\) versus \(r\) and \(d_{\text{S2G}}\), respectively. From Figure 6, we can observe that with the increase of \(r\), the minimum system delay and \(H^{opt}\) increase, but \(\alpha^{opt}\) decreases. The reason is that as \(r\) increases, the rate of the user's uplink transmission to the UAV decreases, and the minimum total delay of the system increases accordingly. In order to minimize the total delay of the system, more computing tasks of the user are offloaded to the BS, so the task allocation ratio of offloading to the UAV \(\alpha\) decreases. However, \(\alpha^{opt}\) in Figure 7 increases with the increase of \(d_{\text{S2G}}\). This is because the decrease of the transmission rate between the user and BS leads to an increase of the total system delay, and computing tasks will be more offloaded to the UAV in order to minimize the total system delay. We compare the results obtained based on Formulas (15) and (18) with the results obtained by one-dimensional search, and we can see that the results coincide basically, indicating the accuracy of our analyses in Section 3. BS, and the task allocation ratio of offloading to BS \(1-\alpha\) increases, i.e., \(\alpha\) decreases. From the two figures, we also see that the optimal flying altitude \(H^{opt}\) remains unchanged. This is because the optimal flying altitude of the UAV in Formula (15) is irrelevant to \(f_{\text{UAV}}\) and \(f_{\text{BS}}\). By comparing the results obtained based on Formulas (15) and (18) with the results obtained from the one-dimensional search, it can be seen that both are basically consistent. Figure 5: Minimum system delay, optimal flying altitude, and optimal task allocation ratio versus bandwidth allocated to BS for task offloading. (**a**) Minimum system delay, (**b**) optimal flying altitude and optimal task allocation ratio. Figure 6: Minimum system delay, optimal flying altitude, and optimal task allocation ratio versus the distance between the UAV’s projection on the ground and the user. (**a**) Minimum system delay, (**b**) optimal flying altitude and optimal task allocation ratio. Figure 8: Minimum system delay, optimal flying altitude, and optimal task allocation ratio versus the CPU frequency allocated for computation on the UAV. (**a**) Minimum system delay, (**b**) optimal flying altitude and optimal task allocation ratio. Figure 7: Minimum system delay, optimal flying altitude, and optimal task allocation ratio versus the distance between the user and the BS. (**a**) Minimum system delay, (**b**) optimal flying altitude and optimal task allocation ratio.