# Compact Bistatic Iterative Passive Radar Based on Terrestrial Digital Video Broadcasting Signals
## 3 Proposal Description
### Iterative Algorithm  
The pseudo-code for the algorithm is described in Algorithm 1, where the matrix that includes the possible changes (updates) at each of the three distances is \[\mathbf{M}= \begin{pmatrix}1&-1&0&0&0&0\\ 0&0&1&-1&0&0\\ 0&0&0&0&1&-1\end{pmatrix}  \tag{15}\]  
Although the pseudo-code of the algorithm in Algorithm 1 encompasses all the steps and mathematical formulations, a concise summary of the process is provided below. ```
1:Initialization:
2:Calculate \(\hat{R}_{t}\) using Equation (11) using estimated distances \(\hat{\mathbf{r}}=\left(\hat{d}\hat{t}_{1}\ \hat{d}\hat{t}_{2}\ \hat{d}\hat{t}_{3}\right)^{T}\) instead of \(\mathbf{r}\)
3:Calculate \(\hat{\mathbf{x}}\) using Equation (9) and \(\hat{R}_{t}\)
4:\(epoch=1\)
5: Re-calculate estimated distances using estimated coordinates \(\hat{\mathbf{x}}\): \[\bar{\mathbf{r}}=\sqrt{\left(\hat{T}_{x}-d_{0}\right)^{2}+\hat{T}_{y}^{2}+ \left(\hat{T}_{z}-E_{z}\right)^{2}}+\sqrt{\left(Rx_{i}-\hat{T}_{x}\right)^{2 }+\left(Ry_{i}-\hat{T}_{y}\right)^{2}+\left(Rz_{i}-\hat{T}_{z}\right)^{2}}\]
6: Calculate the total error: \(\epsilon_{T}=||\hat{\mathbf{r}}-\hat{\mathbf{r}}||^{2}\)
7:while\(\epsilon_{T}\leq TargetError\) AND\(epoch<MaxEpochs\)do\(\triangleright\) Stop condition
8:\(epoch++\)
9:for\(j=1:6\)do
10:\(\mathbf{m}=\mathbf{M}[:,j]\)\(\triangleright\) Select the dimension to modify
11:\(\bar{\mathbf{r}}^{j}=\bar{\mathbf{r}}+\mathbf{m}\cdot\mu\)\(\triangleright\) Update estimation of distances
12: Calculate \(\bar{R}_{t}^{j}\) using Equation (11) using modified distances \(\bar{\mathbf{r}}^{j}\) instead of \(\mathbf{r}\)
13: Calculate \(\bar{\mathbf{x}}^{j}\) using Equation (9) and \(\hat{R}_{t}^{j}\)
14: Calculate new distances \(\bar{\mathbf{r}}^{j}\) using Equation (3) assuming \(\bar{\mathbf{x}}^{j}\) instead of \(\mathbf{x}\)
15: Evaluate the distance error: \(\epsilon^{j}=\left(\bar{\mathbf{r}}^{j}-\bar{\mathbf{r}}^{j}\right)^{2}\)\(\triangleright\) Evaluate error for this choice
16:endfor
17: Sort ascending \(\epsilon\):\(\epsilon_{sorted}\)
18: Calculate the difference between largest and lowest:
19:\(\epsilon_{diff}=\epsilon_{sorted}(3,\cdot)-\epsilon_{sorted}(1,\cdot)\)\(\triangleright\) Maximum - Minimum
20:\(idx=\min\epsilon_{diff}\)\(\triangleright\) Select the one that minimizes
21: Update:
22:\(\bar{\mathbf{r}}=\bar{\mathbf{r}}^{idx}\)\(\triangleright\) Update estimated distances
23:\(\epsilon_{T}=||\bar{\mathbf{r}}-\bar{\mathbf{r}}||^{2}\)\(\triangleright\) Update total error with choice
24:endwhile
25:OUTPUT: \(\hat{\mathbf{x}}\) using Equation (9) with \(\bar{\mathbf{r}}\)
```  
**Algorithm 1** Refinement of coordinates' estimation. Initially, during the algorithm's initialization phase, the estimated distances, \(\hat{d}t_{i}\), obtained from the channel estimation process, is used to estimate the target coordinates, \(\hat{\mathbf{x}}\), as described in Equation (9). Equation (11) is applied to estimate \(\hat{R}_{t}\), which, along with steps 2 and 3, yields the initial coordinate estimate, \(\hat{\mathbf{x}}\). Next, the algorithm calculates the expected distances, \(\hat{d}t_{i}\), assuming that the target coordinates are the previously estimated coordinates, \(\hat{\mathbf{x}}\), resulting in a distance vector \(\bar{\mathbf{r}}\). Using these estimated distances, the total estimation error, \(\epsilon_{T}\), is computed in step 6. This error is used both for iteration and to determine the stop condition. The algorithm iterates until the stop condition is met, either when the total error, \(\epsilon_{T}\), satisfies the condition \(\epsilon_{T}\leq TargetError\) or when the maximum number of iterations is reached. For each iteration, the algorithm computes six coordinate sets, \(\hat{\mathbf{x}}^{j}\), by making small adjustments to one of the estimated distances, \(\hat{d}t_{i}^{j}\), either increasing or decreasing it [step 11]. The coordinates, \(\hat{\mathbf{x}}^{j}\), are then estimated with these modified distances [steps 12 and 13].