## 3 Performance Analysis  
A wireless communication system that comprises two users and one UAV with channel fading is considered. Figure 1 demonstrates a basic UAV communication system model.  
We outline the wireless THz channels' propagation characteristics. The atmospheric absorption loss and open space path loss together make up the entire loss of the signal that was received. In particular, it is well known that oxygen and water vapor absorb a significant amount of energy in the THz channel [34]. We consider a FANET scenario with a UAV node with a THz communication system. Path loss is incurred by the signal from the source to the destination as a function of frequency and distance, which can be calculated as [35]  
\[P_{L}(d,f)=\left(\frac{c}{4\pi fd}\right)^{2}e^{\kappa(f)d}, \tag{1}\]  
Figure 1: System model.  
where \(d\) represents the distance between sending and receiving UAV nodes;\(f\) is the carrier frequency; \(c\) denotes light speed, where the first and second term account for free-space path loss and atmospheric absorption loss, respectively; and \(\alpha(f)\) indicates the atmospheric absorption loss coefficient [36]. It is important to calculate the link budget and investigate the correlation between transmission power, distance, BER, and other design characteristics in order to show that a THz wireless communication connection is feasible.  
The dominance of the LoS signal is affected by changes in the communication medium, such as building density in the area and the height of the UAV. As a result of these effects, the coefficient of channel-fading values changes.  
The UAV's coordinates are indicated by \(c=(x,y,z)\), where the coordinates of user 1 and user 2 are provided by \(c_{1}=(x_{1},y_{1},\,0)\) and \(c_{2}=(x_{2},\,y_{2},\,0)\), respectively. It is assumed that the height of the UAV (\(z\)) is constant.  
The gain in the THz channel between users 1 and 2 and the UAV can be modeled as [37]\(h_{1}=1/d_{1}^{2}e^{\alpha(f)d_{1}}\) and \(h_{2}=1/d_{2}^{2}e^{\alpha(f)d_{2}}\). \(d_{1}(x,y)=\sqrt{\left(x-x_{1}\right)^{2}+\left(y-y_{1}\right)^{2}+z^{2}}\) and \(d_{2}(x,y)=\sqrt{\left(x-x_{2}\right)^{2}+\left(y-y_{2}\right)^{2}+z^{2}}\) are the distances between the users and the UAV. The uplink transmission rate from user 1 to the UAV may be achieved at [38]  
\[R_{1}^{U}(x,y)=B_{1}\log_{2}\left(1+\frac{P_{1}h_{0}}{B_{1}d_{1}^{2}e^{nd_{1}} \sigma^{2}}\right), \tag{2}\]  
where \(B_{1}\) indicates the allocated bandwidth to user 1; \(P_{1}\) designates the transmission power of user 1; Gaussian noise power is shown by \(\sigma^{2}\); and \(h_{0}\) denotes the channel gain at a reference distance, \(d_{0}=1\) m. The path loss exponent is represented by \(\alpha\).  
Similarly, the achievable rate for the downlink transmission from the UAV to user 2 is  
\[R_{2}^{D}(x,y)=B_{2}\log_{2}\left(1+\frac{P_{2}h_{0}}{B_{2}d_{2}^{2}e^{nd_{2}} \sigma^{2}}\right), \tag{3}\]  
where \(B_{2}\) denotes the allocated bandwidth to user 2. \(P_{2}\) indicates the transmission power of the UAV. An algorithm for optimizing \(x\), \(y\), \(P_{1}\), and \(P_{2}\) is proposed in Algorithm 1.  
```
Input:\(x\), \(y\), \(B_{1}\), \(B_{2}\), \(P_{1}\), \(P_{2}\) Calculate Equation (4) with given \(x\), \(y\), \(B_{1}\), \(B_{2}\) values Output:\(P_{1}\), \(P_{2}\) Input:\(B_{1}\), \(B_{2}\), \(P_{1}\), \(P_{2}\) Calculate Equation (7) with given \(B_{1}\), \(B_{2}\) values Output:\(x\), \(y\)
```  
**Algorithm 1** Optimization of the Transmission Power and Trajectory of the Proposed System