2.2.1. Stride Segmentation

The first step in the IMU signal processing for velocity and distance calculation was the stride segmentation. In this step, single strides were extracted from the continuous IMU data stream with a threshold-based algorithm. Common algorithms use the distinct peaks in the acceleration signal in the dorsoventral direction *ay*[*n*] during initial ground contact to mark the beginning of a stride [26]. We enhanced this idea and used the beginning of the distinctive peak to mark the beginning of a stride. This procedure is valid, as the ground already exerts a force to the IMU at the time instance of the peak in the acceleration signal. Using the peak itself would mean to mark a point in time that is part of the ground contact. To find the sample before the acceleration peak, we first differentiated the acceleration signal in the dorsoventral direction *ay*[*n*] and consecutively squared the resulting value to obtain a signal *H*[*n*] with amplified peak values.

$$H[n] = (a\_y[n] - a\_y[n-1])^2\tag{2}$$

In the signal *H*[*n*], the maxima were detected by comparing them to an empirical threshold (empirical threshold: *H*[*n*] > 1000 ( *m <sup>s</sup>*<sup>2</sup> )<sup>2</sup> ). For every detected maximum, the onset of the rise of *H*[*n*] was determined by setting all values below the threshold to zero and looking for the index of the last non-zero value in *H*[*n*] before the detected maximum. This index *nIC* was a potential candidate for an initial ground contact. To eliminate false detections, we added a detector for the swing phase prior to the peak in the acceleration signal. The swing phase detector computed an integral of *ay*[*n*] backwards from the first detected non-zero value until the first zero-crossing. This is the point in time where the foot starts decelerating during the swing phase. The integral value *S*[*nIC*] for the initial ground contact candidate *nIC* was computed as:

$$S[n\_{IC}] = \sum\_{n=n\_{ZC}}^{n\_{IC}} \frac{1}{f\_s} a\_y[n] \tag{3}$$

In this equation, *nZC* corresponds to the index of the zero crossing marking the start of the deceleration. If the integral value *S*[*nIC*] exceeds an empirically-set threshold (empirical threshold: *<sup>S</sup>*[*nIC*] <sup>&</sup>lt; <sup>−</sup>3[ *<sup>m</sup> <sup>s</sup>* ]), a swing phase is detected, and thus, the index of the first non-zero value before the acceleration peak is labeled as an initial ground contact. The described stride segmentation is depicted in Figure 2.

**Figure 2.** Example for the stride segmentation. The plot shows the acceleration signal in the dorsoventral direction *ay*[*n*], the detected initial ground contact *nIC*, and the beginning of the swing phase (zero crossing *nZC*) to confirm the stride candidate. The marked area depicts the integration area for the swing phase detection.
