2.3.3. Signal Processing

Four stages of signal pre-processing were performed consecutively as shown in Figure 8. The low pass filter with a cut-off frequency of 3 Hz was first applied followed by a moving average filter with 5 point. The gait signal was smoothed and noise was removed. The first-order differential filter was then applied to sharpen the gradients on the y-axis, making the high peaks higher and the low peaks lower. This process made the slope of the original signal steeper and more prominent as the change value on the y-axis increased. This study developed an algorithm to detect the highest peaks at the time of the heel strike and toe-off, at an interval of 300 ms. Considering person-to-person gait pattern difference, the interval range was selected based on our previous gait analysis study results using the prototype insole sensor in healthy young adults [35]. The heel strike and toe off were detected within 300 ms intervals.

This was designed based on a local maxima algorithm.

**Figure 8.** Signal processing order.

Each initial contact (heel strike) of one side of the leg was marked and calculated for the step count and a stride time was defined by the time between two consecutive heel strikes of the same foot [37]. The coefficient of variation (CV) of the stride time was calculated [38].

327

*Sensors* **2019**, *19*, 3950

PCI was calculated by first defining the stride time of one foot as a gait cycle (360◦; from one leg's heel strike to the next heel strike) and the phase (ϕ ideally 180◦; time point of contralateral heel strike). The phase of the ith stride (ϕ*i*, in degrees) is defined by normalizing the step time with respect to the stride time Equation (3). The sum of the CV of phase (ϕ\_CV) and the mean absolute difference between phase and 180◦ <sup>ϕ</sup>ABS was defined as PCI [21,22]. ϕ*<sup>i</sup>* is an index that evaluates the symmetry of bilateral stepping phases and is the distance between one heel strike and the next of the opposite leg calculated in degrees, ideally 180◦ for successful walking. The step time of each leg should normally be equal to the half the gait cycle, but for the asymmetric cases *tSi* refers to the shorter swing phase and *tLi* for the longer swing phase; the time of heel strike (of step *i*) during short and long swing phases, respectively. As shown below in the equation, ϕ\_ABS indicates the balance between the two feet Equation (4). ϕ\_CV refers to the coefficient of variation of ϕ*<sup>i</sup>* which represents a consistency of both feet during walking Equation (5).

$$q\_{\bar{i}} = 360^{\circ} \times \frac{t\_{S\_i} - t\_{L\_i}}{t\_{L(i+1)} - t\_{L\_i}} \tag{3}$$

$$
\varphi\_{-}ABS = \frac{\varphi\_{-}ABS}{180} \times 100\tag{4}
$$

$$\varphi' = \frac{1}{N} \sum\_{i=1}^{n} \varphi\_i \,\delta = \sqrt{\frac{1}{N}} \sum\_{i=1}^{n} \left(\varphi' - \varphi\_i\right)^2,\\ \varphi\_- \heartsuit V = \frac{\delta}{\varphi'} \tag{5}$$
