# Adaptive Algorithm for Fast 3D Characterization of Magnetic Sensors
## 2 Materials and Methods
### Adaptive Filter
Consequently, a number of coefficients \(N_{\text{DT}}\) at the end of the adaptive filter \(\hat{\mathbf{h}}(n)\) should be zero for a correct system identification as  
\[\left[h_{N-N_{\text{DT}}-1},h_{N-N_{\text{DT}}},\ldots,h_{N-1}\right]=\mathbf{0} \tag{24}\]  
is assumed. Since the estimation error for an adaptive filter is spread equally among its coefficients [24], an estimate of the system distance can be calculated according to  
\[\hat{\Gamma}_{\text{DT}}(n)=\frac{N}{N_{\text{DT}}}\sum_{j=N-N_{\text{DT}}-1}^ {N-1}\hat{\mathbf{h}}_{j}^{2}(n), \tag{25}\]  
as introduced for artificial delays in [28]. In addition to employing this approach as a standalone solution for the estimation of the system distance, the result is utilized as the initial value for the contraction-expansion approach (CEA) for step size control (cf. [15]). For this, we use the contraction parameter \(A\big{(}\mu,N\big{)}\) describing the theoretical adaptation in undistorted conditions, defined for our case as  
\[A\big{(}\hat{\mu}(n),N\big{)}=\frac{\hat{\mu}^{2}(n)}{N}-\frac{2\hat{\mu}(n)}{ N}+1, \tag{26}\]  
and the expansion parameter \(B\big{(}\mu,N\big{)}\), both formulated only with regard to step size (without regularization), as  
\[B\big{(}\hat{\mu}(n),N\big{)}=\frac{\hat{\mu}^{2}(n)}{N}, \tag{27}\]  
which encompasses the influence of noise on the adaptation process [24]. Together, they enable the description of a propagating system distance estimate \(\hat{\Gamma}_{\text{CEA}}(n)\) depending on the previous estimation, the power of the excitation signal estimated by its smoothed short-term value, and the estimated noise power \(\hat{\sigma}_{b}^{2}\), formulated as  
\[\hat{\Gamma}_{\text{CEA}}(n)=A\big{(}\hat{\mu}(n-1),N\big{)}\,\hat{\Gamma}_{ \text{CEA}}(n-1)+B\big{(}\hat{\mu}(n-1),N\big{)}\frac{\hat{\sigma}_{b}^{2}}{ \overline{x^{2}(n)}} \tag{28}\]  
according to [15; 24]. As mentioned above, the estimate \(\hat{\Gamma}_{\text{DT}}\) is used to initialize this estimation, since the approach only acts iteratively on this initial guess and should therefore be determined by a reasonable assumption given by the dead-time concept. The estimation of the noise power is achieved in a short, adjustable period of \(N_{b}\) samples before the start of the actual adaptation process. For this, the excitation signal is set to zero and the smoothed sensor signal power is averaged over the given period:  
\[\hat{\sigma}_{b}^{2}=\frac{1}{N_{b}}\sum_{k=0}^{N_{b}-1}\overline{y^{2}(k)}. \tag{29}\]To avoid possible transient effects distorting the characterization at the start of excitation after this noise estimation period, there is also a short settling period of \(N_{\text{set}}\) samples afterwards in which the first excitation signal is active but before the adaptation process starts. With all of these step size options, we have several thresholds and conditions to determine when which approach is used. Firstly, at the start time \(n_{0}\) of adaptation from a new direction, we use a time-based threshold \(N_{\text{fix}}\) up to which we use a fixed step size \(\mu_{\text{fix}}\). This is to account for the known change of the overall system--that is, the change in the direction of the excitation field--which is bound to change the system behavior and thus lead to a sudden increase in the system distance. The fixed step size enables us to adapt to the new system behavior quickly and to enable the system distance estimate to readjust to new circumstances. After that, we use the ratio \(\overline{e^{2}(n)/y^{2}(n)}\) between the smoothed error signal power and the smoothed sensor signal power as an indicator of convergence.