## 3 Strategy and Performance Analysis of Spread Spectrum Code Acquisition
### Aperiodic Long Code Acquisition Process  
The block diagram of burst spread spectrum code acquisition based on a matched filter is shown in Figure 6.  
Assuming that the spread spectrum multiple is \(N\), the following strategies are generally adopted for synchronous acquisition in engineering:  
The first step--The local spread spectrum code sequence is correlated with the received signal of different delays, and the sampling of the 2\(\times\) bit rate clock is performed. There can be \(2N\) correlation values in 1 symbol period. Since the spread spectrum code is an aperiodic long code, there are \(2 NL\) possible correlation values. The expression after correlation is  
\[ \begin{split} Y_{l}(q)&=\frac{1}{N}\sum\limits_{k= lN}^{(l+1)N-1}c^{*}(k)r(k-q)\approx Ad_{l}h(-\tau T_{c})\frac{\sin(\pi fT)}{\pi fT}e^{i \varphi_{l}}+\frac{1}{N}\sum\limits_{k=lN}^{(l+1)N-1}c^{*}(k)n(k)+n_{2,l}(q)\\ &=Be^{j\varphi_{l}}+n_{1,l}(q)+n_{2,l}(q)\end{split}  \tag{2}\]  
where \(B=Ah(-\tau T_{c})\sin c(fT)\). \(n_{1,l}\sim N(0,\sigma_{n}^{2}/N)\), where \(n_{2,l}\) is the noise caused by inter-code crosstalk, which can be ignored. The local spread spectrum code is \(c(k)\). \(q\) is the number of shift chips, \(q=lN,lN+1/2,\ldots,(l+1)N-1\). \(h(t)\) is the raised cosine function, and \(h(-\tau T_{c})\) is the amplitude change caused by the code synchronization error. \(\sin c(fT)\) is the amplitude change caused by frequency offset. \(\varphi_{l}\) is code phase. For the relevant calculations, please refer to Appendix B.  
Binary hypothesis testing is adopted, where  
\[ \begin{cases}\quad Y_{l}(q)=n_{1,l}(q),&H_{0}\\ Y_{l}(q)=Be^{j\varphi_{l}}+n_{1,l}(q),&H_{1}\end{cases}  \tag{3}\]  
Here, \(H_{0}\) is set under the condition that the sender does not send a spread spectrum signal or the local code is not aligned with the received signal, and \(H_{1}\) is set under the condition of the local code being basically aligned with the received signal. \(Y_{l}\) is a complex signal, where the signal in I channel is \(Y_{I}\) and thesignal in Q channel is \(Y_{Q}\), and \(Y_{l}=Y_{I}+jY_{Q}\). The conjugate multiplication of \(Y_{l}\) yields  
\[Z_{l}(q)=Y_{l}(q)Y_{l}^{*}(q)=\sum Y_{l}^{2}(q)+Y_{Q}^{2}(q) \tag{4}\]  
Figure 6: Block diagram of spread spectrum code acquisition based on matched filter. In the second step, the correlation values, \(Z_{l}\), obtained in the first step are incoherently accumulated \(L\) times, and \(2q\) test statistics are obtained,  
\[Z(q)=\sum_{l=0}^{L-1}Z_{l}(q)=\sum_{l=0}^{L-1}Y_{l}^{2}(q)+Y_{Q}^{2}(q) \tag{5}\]  
In the third step, the test statistic \(Z(q)\) obtained in the second step is compared with the threshold \(V_{th}\). If the value is greater than the threshold, it is considered as synchronization. If the threshold is not exceeded, the next statistics and judgment are carried out. It is hoped that only \(1\) of the \(2 LN\) possible correlation values that are fully synchronized will exceed the threshold. Let \(P_{n}\) present the noise power \(\sigma_{n}^{2}/N\), and so the symbol signal-to-noise ratio is \(\mu=B^{2}/P_{n}\). \(p_{0}\) is the probability density function under the condition of \(H_{0}\) and \(p_{1}\) is the probability density function under the condition of \(H_{1}\). By integrating \(p_{0}\) and \(p_{1}\), the unit false alarm probability \(P_{f}\) and unit detection probability \(P_{d}\) of each decision can be obtained. Let the normalized threshold be \(\lambda=V_{th}/\sigma_{0}^{2}\), according to [5; 26]  
\[P_{f}=\int_{V_{th}}^{\infty}p_{0}(Z)dZ=\int_{\lambda}^{\infty}p_{0}(z)dz=\int_ {\lambda}^{\infty}\frac{x^{L-1}e^{-z}}{(L-1)!}dz=e^{-\lambda}\sum_{k=0}^{L-1} \frac{\lambda^{k}}{k!} \tag{6}\]  
\[P_{d}=\int_{V_{th}}^{\infty}p_{1}(Z)dZ=\int_{\lambda}^{\infty}(\frac{x}{L\mu} )^{(L-1)/2}e^{-(x+L\mu)}\Phi_{L-1}(2\sqrt{L\mu x})dx=Q_{L}(\sqrt{2L\mu},\sqrt{ 2\lambda}) \tag{7}\]  
where \(Q_{L}(a,b)\) is an \(L\)-order Marcum Q function, which can be solved by calling function \(marcumq(a,b,L)\) in matlab.