# Energy Efficient Underlaid D2D Communication for 5G Applications
## 3 Proposed Modified Derivative Algorithm  
The difference between a derivative algorithm and a proposed modified derivative algorithm is a computational complexity. In the proposed modified derivative algorithm, computational complexity is less when compared with the derivative algorithm; this is explained clearly from Step 8 to Step 10 and in the corresponding flow chart for the proposed modified derivative algorithm. Here we considered the parameters of both the methods the same because with those parameters the proposed modified derivative algorithm produced better performance when compared to the exiting method. Here we plotted both the method's performance graphs. We proposed a modified derivative algorithm as shown in Figure 2. The maximum value of \(\mathrm{f_{i}}\left(\mathrm{D_{p,i}}\right)\) can be obtained by \(\mathrm{D_{p,i}}=\mathrm{D_{p,i,max}}\). Where \(\mathrm{D_{p,i,max}}\) denotes the global maximum point of \(\mathrm{f_{i}}\left(\mathrm{D_{p,i}}\right)\) on the interval [\(\mathrm{D_{p,i,inf}}\), \(\mathrm{D_{p,i,sup}}\)]. The \(\mathrm{EE_{d}}\) achieves the maximum value when every \(\mathrm{EE_{d,i}}\) achieves the maximum value in the feasible region. This is obtained when every \(\mathrm{D_{p,i}}\) is mutually independent. Here every \(\mathrm{D_{p,i}}\) is mutually independent when the equality constraint \(\sum_{i=1}^{k}\mathrm{D_{p,i}}=\mathrm{D_{p}}\) is removed. We can calculate \(\mathrm{D_{p,i,max}}\) for \(\mathrm{I=1,2,\ldots,K}\); the least reduction in \(\mathrm{EE_{d}}\) can be achieved by adjusting the value of \(\mathrm{D_{p,i}}\) to meet the equality constraint \(\sum_{i=1}^{k}\mathrm{D_{p,i}}=\mathrm{D_{p}}\). **Step 1**: Initialize the threshold value. **Step 2**: Calculate the power transmission of D2D users for ith band. **Step 3**: After calculating we get the maximum \(\mathrm{D_{p,i}}\)  
\[\mathrm{D_{p,i}}=\mathrm{D_{p,i,max}}\]  
**Step 4**: To achieve the least reduction in EE, the value of \(\mathrm{D_{p,i}}\) needs to be adjusted to meet the equality constraint. **Step 5**: Consider \"n\" as the parameter that checks the balance between performance and computation. Hence, according to practical requirements, we can adjust the value. **Step 6**: We consider the \(\text{der}_{\text{i}}\) variable to set a value to save. It is used to select an appropriate value for \(\text{D}_{\text{p,j}}\) in further steps. **Step 7**: To exit the loop, we used a threshold value instead of a counter. Because if \(\text{D}_{\text{p,j}}\) was chosen in the latest iteration, it will surpass the global optimum; in this case, we had to choose another \(\text{D}_{\text{p,j}}\) iteration to modify. This situation is unpredictable and iterations are not determined either. **Steps 8 and 9**: After all adjustments in \(\text{D}_{\text{p,j}}\), if it was overstepping the feasible region, we set \(\text{der}_{\text{i}}\) to infinite, preventing j from being chosen. As a result, we avoided the occurrence of an infinite loop. **Step 10**: In this, we updated the \(\text{der}_{\text{j}}\) variable instead of every \(\text{der}_{\text{i}}\) variable since for i = 1, 2, 3,..., k & not equal to j, \(\text{der}_{\text{i}}\) remains unchanged after adjusting \(\text{D}_{\text{p,j}}\). **4. Simulation Results**  
Table 1 presents the main simulation parameters by using the derivative algorithm. Figure 2: Flow chart for the proposed modified derivative algorithm. Figure 3 shows the energy efficiency of D2D users with the reference density of D2D users by using the derivative algorithm. We assumed an uplink environment where 5 multiple bands of spectrum with bandwidth 20 MHz are shared by cellular and devices users. As the D2D users increase the EE rises, and then it slowly decreases; if the cellular user's transmission power is 325 mW, 375 mW, and 425 mW are fixed. This is a result of the increasing distortion brought on by cellular transmission. We also observed that the EE decreases with the increase of cellular power because the increase in cellular power creates interference.