# Adaptive Algorithm for Fast 3D Characterization of Magnetic Sensors
## 2 Materials and Methods
### Adaptive Filter
We cannot influence the update term directly, as it only depends on the (random) excitation signal vector, which we define as the last \(N\) samples of the discrete signal used for the field generation calculations (see Section 2.1) and the resulting error signal. The normalization employed is relative to the excitation signal vector's norm, which can be efficiently calculated by the recursion  
Figure 4.0  
as described in [24] with a robust implementation that we used as a template [27]. To tune the adaptive filter towards the desired behavior (a minimal remaining system distance with fast convergence), we can instead influence the filter update in (16) via the step size parameter. An alternative would be the control of the filter behavior relying only on a regularization term as the divisor to the correction term \(\Delta_{\mathrm{corr}}\big{(}\mathbf{x}(n),e(n)\big{)}\) or a combination of both approaches [24]. Since these are mutually convertible and previous work uses step size control [15], we also choose a step-size-only approach. For a stable update behavior of the algorithm, the step size has to be between 0 and 2. In the most naive approach, we can use a constant step size \(\mu(n)=\mu_{\mathrm{fix}}\). A step size close to, but not exceeding, 1 leads to a fast adaptation with the trade-off of a comparatively higher system distance. Conversely, a small step size (close to 0) can achieve a smaller final system mismatch over a longer adaptation time [24]. Time varying step size control approaches try to mitigate this trade-off by using a large step size at first for a fast convergence and by gradually reducing the factor to arrive at a more desirable system distance. In contrast to [15], we do not consider a remaining system component as a part of the sensor system noise, since the decay behavior is assumed to be much faster in the electromagnetic domain in contrast to (underwater) acoustics. We get a pseudo-optimal variable step size based on the mean power of the undisturbed error \(e_{\mathrm{u}}(n)\) in the form of  
Figure 4.1  
as derived in [28]. The undisturbed error describes the actual difference between the ideal sensor output and the filter output signal  
Figure 4.2  
When taking into account practical implementations, we can neither use expectation operators as in (19), nor have knowledge of the ideal sensor output. Thus, we use short-term smoothing for the estimation of the expected values. Our smoothing, denoted by an overline, uses a two-parameter IIR filter approach [24]: the power of an example signal \(s(n)\) is combined with the smoothing parameter \(\gamma(n)\) according to  
Figure 4.3  
To account for differences in smoothing behavior for rising and falling signal power, the smoothing parameter is set to a rising constant \(\gamma_{\mathrm{r}}\) if the instantaneous power exceeds the previously smoothed short-term power and to a different falling constant \(\gamma_{\mathrm{f}}\) otherwise:  
\[\gamma(n)= \begin{cases}\gamma_{\mathrm{r}},&\text{if }s^{2}(n)>\overline{s^{2}(n-1 )},\\ \gamma_{\mathrm{f}},&\text{else},\end{cases} \qquad 0<\gamma_{\mathrm{r}}<\gamma_{ \mathrm{f}}<1. \tag{22}\]In addition to this, we split up the undisturbed error power into excitation power and the estimated system distance with a new symbol \(\Gamma(n)\)[15]. This leads to the general variable step size  
\[\hat{\mu}(n)=\frac{\overline{e_{\mathbf{n}}^{2}(n)}}{\overline{e^{2}(n)}}=\frac{ \overline{x^{2}(n)}\Gamma(n)}{\overline{e^{2}(n)}}, \tag{23}\]  
which is now only missing the system distance estimate. We employed two different methods for this estimation, which will now be described. The first method is dead-time (DT) coefficient-based system distance estimation. Here, we assume that the length of the target impulse response is shorter than the (accordingly) chosen length of the adaptive filter \(N\).