# Analytical Model of an Energy Detector for Ultra-Wideband Chaotic Communications
## 2 Energy Detector Model
### Energy Statistics and Optimal Threshold  
Thus, we approximated the energy sample statistics with the following functions:  
\[w_{0}(x)\ =\ \frac{1}{\sigma_{noise}^{2}\sqrt{4\pi n}}e^{-\frac{(x-\overline{ E_{1}})^{2}}{4\pi n_{noise}^{4}}}, \tag{6}\]  
\[w_{1}(x)\ =\ \frac{1}{(1+\gamma)\sigma_{noise}^{2}\sqrt{4\pi n}}e^{-\frac{(x- \overline{E_{1}})^{2}}{4\pi n_{noise}^{4}(1+\gamma)^{2}}}, \tag{7}\]  
where \(\overline{E_{0}}\ =\ n\sigma_{noise}^{2}\) and \(\overline{E_{1}}\ =\ \overline{E_{0}}(1+\gamma)\) are the average energy of the received signal on the interval [0, \(T\)] in the absence and in the presence of radio pulse, respectively. These functions are shown schematically in Figure 2.  
Figure 2: Energy distribution functions for symbols “0” and “1”.  
To distinguish the received symbols, let us introduce a pulse energy threshold \(X_{T}\), such that the received symbol is \"0,\" if \(X_{D}\) sample at the output is below the threshold, i.e., \(X_{D}(T)<X_{T}\); otherwise, the received symbol is \"1\".  
We define the detection error probability \(P_{err}\) as the sum of the error probabilities for each of the two binary symbols. To evaluate \(P_{err}\), we calculate the hatched area in Figure 2. If the binary symbols \"0\" and \"1\" are transmitted with probabilities \(p(0)\) and \(p(1)\), then:  
\[P_{err}\ =\ P_{err,0}+P_{err,1}\ =\ p(0)\int_{X_{T}}^{\infty}w_{0}(x)dx+p(1)\int_{ -\infty}^{X_{T}}w_{1}(x)dx. \tag{8}\]  
The optimal threshold is obtained by means of minimizing the functional \(P_{err}(x)\), which gives the following equation for \(X_{T}\):  
\[p(0)w_{0}(X_{T})\ =\ p(1)w_{1}(X_{T}). \tag{9}\]  
To solve Equation (9), we expand functions \(w_{0}\) (6) and \(w_{1}\) (7)  
\[\frac{p(0)}{\sigma_{noise}^{2}\sqrt{4\pi n}}e^{-\frac{(x-\overline{E_{0}})^{2 }}{4\pi\sigma_{noise}^{4}}}\ =\ \frac{p(1)}{(1+\gamma)\sigma_{noise}^{2}\sqrt{4\pi n}}e^{- \frac{(x-\overline{E_{1}})^{2}}{4\sigma_{noise}^{4}(1+\gamma)^{2}}}, \tag{10}\]  
take a natural logarithm of both sides  
\[\ln p(0)-\frac{\left(x-\overline{E_{0}}\right)^{2}}{4n\sigma_{noise}^{4}}\ =\ \ln p(1)-\frac{\left(x-\overline{E_{1}}\right)^{2}}{4n\sigma_{noise}^{4}(1+ \gamma)^{2}}-\ln(1+\gamma), \tag{11}\]  
introduce a new variable \(y\ =\ x/\overline{E_{0}}\ =\ x/\left(n\sigma_{noise}^{2}\right)\), and, after rearrangement, obtain a quadratic equation:  
\[y^{2}-2\frac{1+\gamma}{2+\gamma}y-\frac{4}{n}\frac{\left(1+\gamma\right)^{2} }{\left(\left(1+\gamma\right)^{2}-1\right)}\ln+\ln\left(\frac{p(0)}{p(1)}(1+ \gamma)\right)\ =\ 0. \tag{12}\]  
Equation (12) has two real roots, a negative one, which we discard, and a positive one, which gives us an explicit expression for the optimal threshold:  
\[X_{T}\ =\ \overline{E_{0}}\frac{1+\gamma}{2+\gamma}\left(1+\sqrt{1+\frac{4}{B} \frac{2+\gamma}{\gamma}\ln\left(\frac{p(0)}{p(1)}(1+\gamma)\right)}\right). \tag{13}\]  
Here, parameter \(B=2\lambda\!f\!\cdot\!T\) is the base (processing gain, number of freedom degrees) of the signal, and \(\gamma\ =\ \frac{\sigma_{noise}^{2}}{\sigma_{noise}^{2}}\) can be treated as a sort of signal-to-noise ratio (SNR) at the receiver input. Actually, in the case \(p(0)=p(1)=0.5\), \(SNR\ =\ \frac{P_{phase}}{P_{noise}}\ =\ \frac{7}{2}\), because the average signal power \(P_{chan}\) is half the pulse power.  
In order to simplify further expressions, we introduced \(Y_{T}\ =\ X_{T}/\overline{E_{0}}\). In Figure 3 a bunch of \(Y_{T}\) curves corresponding to different values of \(B\) is plotted (\(p(0)=p(1)=0.5\)). As can be seen, for large \(B\) (>100) the optimal threshold value \(Y_{T}\) is confined in the range \(1\leq Y_{T}\leq 2\). The larger \(B\), the less the discrepancy between the curves, so that for \(B\geq 1000\) the threshold becomes practically independent of \(B\). Additionally, since the most interesting range of SNR is [-10... 0 dB] (see Figure 4), it seems that expression (13) could further be approximated by some simpler formula.