Comparative analysis of different adaptive filters for tracking lower segments of a human body using inertial motion sensors

For all segments and tests, a modified Kalman filter and a quasi-static sensor fusion algorithm were equally accurate (precision and accuracy ∼2–3°) compared to normalized least mean squares filtering, recursive least-squares filtering and standard Kalman filtering. The aims were to: (1) compare adaptive filtering techniques used for sensor fusion and (2) evaluate the precision and accuracy for a chosen adaptive filter. Motion sensors (based on inertial measurement units) are limited by accumulative integration errors arising from sensor bias. This drift can partly be handled with adaptive filtering techniques. To advance the measurement technique in this area, a new modified Kalman filter is developed. Differences in accuracy were observed during different tests especially drift in the internal/external rotation angle. This drift can be minimized if the sensors include magnetometers.


Introduction
The standard equipment for clinical human motion analysis is predominantly optical motion capture systems using highspeed cameras and skin markers [1]. These systems provide accurate information about three-dimensional kinematics. One important application area is gait analysis, where movement parameters and motion curves are extracted in order to gather information about neurological and musculoskeletal disorders. These reports are used, e.g., to support clinical decisions about treatment strategies. Several research studies point out a different surgery decision outcome after gait analysis [2][3][4][5][6][7][8].
Even though there are many other clinical areas (e.g. [9]) that could make use of motion analysis in daily routines, this Content from this work may be used under the terms of the Creative Commons Attribution 3.0 licence. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI. is rarely done as the motion registration must be performed in a movement laboratory with trained personnel. Instead, in a majority of cases, movement capacity is evaluated by visual inspection of the individual's movement pattern [10,11], and by clinical instruments grading movement dysfunction. A disadvantage with this strategy is that the registration of body movement and postures clearly depends on the observer's observation capacity, skills and motivation, and that many aspects of motion patterns cannot be captured with eyes only. Furthermore, objective motion parameters received from movement registrations can be stored in patient journals for evaluation and follow-ups, which is an advantage.
Morris et al proposed a technique to capture human motion that is based on body-fixed acceleration sensors [12]. Many studies have since then used low-cost inertial measurement units (motion sensors) including accelerometers and gyroscopes and sometimes also magnetometers to study human motion, e.g. [13][14][15][16][17][18][19][20][21]. Wearable motion sensors have the advantage, compared to optical motion capture systems, that measurements are made portable and can therefore be conducted in other settings than a movement laboratory [22]. One limitation with low-cost motion sensors (sensors including accelerometers and gyroscopes only) is the accumulative integration errors arising from bias drifts. This drift can (at least partly) be handled with different adaptive filtering techniques. Favre et al used a drift correction of gyroscope at quasi-static points in time by correcting the orientation of the motion sensor to the gravitation axis in space, measured by the accelerometer [16][17][18]. A drawback of this method is that drift is handled only at specific discrete points in time, leading to sudden jumps in the signal (then in turn affecting the signal precision) when there is an adjustment to a sensor's true orientation. This negative effect can be reduced if a regression of the gyroscopic baseline level is performed between two adjacent quasi-static points in time.
Olivares et al compared different algorithms on synthesized and real signals and found a recursive least-squares filter (RLS) to be the most robust algorithm under both low-and highintensity conditions [23], while the Kalman filter used in their study did not converge to the proper solution. We suggest that a modification of the Kalman filter, using an adaptive weighting of acceleration and gyroscope signals, may improve the performance of the Kalman filter [24].
A functional calibration (FC) procedure is needed to reorient the motion sensors' coordinate frames so that they are aligned with anatomical coordinate frames, in order to calculate joint angles correctly. An inertial-based FC procedure suitable for the knee joint has been proposed [16], but in order to get a complete lower body model with pelvis and hip joints, the FC procedure needs to include the pelvis segment. Further, it is important to investigate the applicability of the system for different type of segments, movement amplitudes and velocities. Earlier studies describe optimizing adaptive filtering techniques [23], but not for specific segments.
To advance the measurement technique in this area, better adaptive filtering techniques and measurement procedures are needed. Thus, the aims of this study were to: (1) compare different adaptive filtering techniques used for sensor fusion of data from inertial motion sensors and (2) evaluate how the precision and accuracy of a chosen adaptive filter varies when used for studying different lower human body segments. This analysis was done in a group of five healthy subjects, during a set of functional tests often used in the examination of musculoskeletal and neurological diseases. This paper is organized as follows: section 2 includes material and methods used in this study. Section 3 presents the results. Sections 4 and 5 present the discussion and conclusions and future work. Finally, there is an appendix describing the calculations made in the functional calibration procedure.

Subjects
Five males (41 ± 13 years, BMI 24.7 ± 2.6) with no previous known history of pain or disability in back or legs participated in this study. Informed consent was obtained from the subject prior to participating and the study was approved by the Regional Ethical Review Board (Dnr 09-120M).

Measurement setup and system description
To be able to compare the ambulatory system with an optical reference system, the measurements were performed in a movement laboratory, and motion was synchronously registered with both systems. The movement laboratory was equipped with a 3D motion capture system with reflective markers (Oqus R , Qualisys Gothenburg, Sweden, 240 Hz, 8 cameras). An orthosis, including one motion sensor and four reflective markers, was attached to each body segment (figure 1). Five segments were included in the model; right and left thigh, right and left shank and pelvis. The raw data consisted of 3D coordinates of markers located on a rigid piece of orthosis. The portable system consisted of a batterypowered unit with a microprocessor that communicated with five motion sensors (Analog Devices, Adis 16350, resolution 14 bits, full scale range ± 300 • s −1 and ± 10g for gyroscopes and accelerometers, respectively, sample frequency 256 Hz).

Maximal hip
The subject was standing straight with both hands resting on a support to keep balance. Five flexion repetitions of maximal hip flexion at self-selected speed were done by flexing and extending the leg maximally while holding the knee joint fixed.

Maximal hip
The subject was standing straight with both hands resting on a support to keep balance. Five abduction repetitions of maximal hip abduction at self-selected speed were done by maximally abducting the leg while holding the knee joint fixed and then returning to the standing position. Two leg squat The subject was standing straight, and performed 10 repetitions of knee bending. The subject was instructed to keep the back straight while flexing the knees to a comfortable position before returning to neutral position. Gait The subject walked 10 m at self-selected speed. This was repeated 10 times. One leg The subject was standing straight with hands crossed over the chest. The subject was then standing instructed to stand on one leg for 60 s. If the subject lost balance, they were allowed to put down the foot in order to retain the balance, and then continue the task. This was repeated once for each leg.
The angular resolution of the sensors were estimated to be approximately 0.06 • (i.e. when angular motion is slow the output depends mainly on accelerometric data and since the accelerometer is digitized with 14 bits in the range ± 10g this leads to a resolution of 20/2 14 rad ≈ 0.06 • ). The raw data (i.e. 3D acceleration and 3D angular velocity) were wirelessly transmitted to a PC.

Test procedure
Each subject performed a motion sequence that was used for the FC procedure of each marker cluster and each motion sensor (see appendix). Movements used for FC of the leg sensors were: knee extension, leg abduction, and hip outward rotation with flexed knee, according to Favre et al [16,17] (shown in figure 1). Upper body forward flexion was used for FC of the pelvis sensor (shown in figure 1). Each subject then performed five different standardized functional tests: (1) maximal right/left hip flexion, (2) maximal right/left hip abduction, (3) two leg squat, (4) gait and (5) one leg standing, further described in table 1. These tests were selected as they are frequently used in the investigation of musculoskeletal and neurological diseases [4,7,8,[25][26][27][28][29][30][31][32].

Data analysis
MATLAB R2010A (Mathworks) was used for all calculations stated below. Both motion sensor data and data from the optical reference system were downsampled to 100 Hz. The gyroscope (ω(t)) and accelerometer (a(t)) signal were scaled using values from the manufacturer (see blocks 1 and 2 in figure 2). Najafi et al describes in a study that movement patterns during gait correspond to frequencies between 0.6 and 5.0 Hz [33]. In studies that examine physiological tremor or shock transmissibility of biomaterials the frequency component may reach 25 or 60 Hz [34]. In this study, natural movements that may occur in a real situation were investigated, excluding oscillatory movements (e.g. trembling that may occur in Parkinsonian patients). Movement data were therefore assumed to be band limited between 0 and 10 Hz. Data were therefore filtered using a bidirectional second-order Butterworth low-pass filter with cut-off ( f c ) set at 10 Hz, prior to further calculations (see figure 2). To speed up the gyroscopic baseline correction, the signal's initial baseline mean (t ∈ {0, . . . , 50 samples}) was removed from all subsequent signal values. In addition, a(t) was normalized by dividing it with a(t ) using the same initial baseline period. As illustrated in block 2 (figure 2), slow drift components of ω(t) were further reduced using a Kalman high-pass filter (time constant τ = 5.5 s) described by the following state equation (x(t)) and dynamic state model (dx(t)/dt): where b denotes a pseudo static offset and where I is the identity matrix, n 1 describes the process variance in ω(t), n 2 describes the process variance in b(t), and Q i ∈ {i = 1, 2} denotes process noise. This high-pass Kalman filter only affects the drift in the gyroscope signal and not the output of the adaptive filters mentioned below. This gave a discrete state model x k and measurement model z k according to the following equations: Block diagram illustrating (1) the pre-processing of accelerometer data, (2) pre-processing and filtering of gyroscopic data and (3) data fusion of output from blocks 1 and 2. The accelerometer sensitivity (G as ) and sensitivity temperature coefficient (L as ), temperature coefficient of the accelerometer bias (G ab ), gyroscope sensitivity (G ωs ), sensitivity temperature coefficient (L ωs ), temperature coefficient of the gyroscope bias (G ωb ), voltage sensitivity (V ωb ) and linear acceleration effect (L ωb ) were all set to default values given by the manufacturer. The cut-off frequency ( f c ) in blocks 1 and 2 was set to 10 Hz. The parameters ε a , ε 0 and ε ω defined quasi-static points in time and were used for calculating q 1t and q 2t . Note the different values for ε a . The parameters ε a , ε 0 and ε ω were all empirically estimated from a previously collected gait recording. The measurement noise (R) and process noise (Q) in block 2 were set according to section 2.4. In block 3, R aω1 (t) and R aω2 were set according to section 2.4.4.
where R denotes measurement noise Q i , and R i (i ∈ {1, 2}) were estimated empirically from a previously collected gait recording (i.e. collected measurements in this study were neither used for selecting Q i nor R i ). Angular rotation data from the marker coordinate data were obtained in the form of direction cosine matrices (DCMs) using rigid body calculations [35]. Motion sensor data were calculated in the form of quaternions (q). The quaternionbased fusion of gyroscopic and accelerometric data was done using five different filters: (1) normalized least mean squares filter (NLMS), (2) recursive least-squares filter (RLS), (3) sensor fusion using quasi-static events in time, according to Favre et al [16], (4) standardized Kalman filter and (5) modified Kalman filter. During this fusion, each sensor's orientation (q(t)) was calculated as the relative orientation against the global gravity vector Z.

Normalized least mean squares filter.
Normalized least mean squares filter (NLMS) is a special case of the adaptive least mean squares (LMS) algorithm developed by Widrow [36] based on an adaptive finite impulse response (FIR) filter. The drawback of LMS is its sensitivity to the input scaling which also makes it difficult to choose a learning rate that makes the filter robust. To overcome this problem NLMS solves by normalizing the input signal x(t) with input power, x(t)x(t) T . Each iteration t of the NLMS algorithm requires the following four steps: (1) Calculate the output y(n) of the FIR filter: where N denotes the filter tap length and w is the FIR filter weights.
(2) Calculate the error signal e(t) as the difference between the desired signal d(t) and the filter output y(n), i.e.
(3) Update the step size value μ: (4) Update the FIR filter weights to prepare for the next iteration t + 1: The filter setting was set according to the paper by Olivares et al, i.e. N = 600, μ(0) = 1.5 [23].

Recursive least-squares filter.
The recursive leastsquares filter (RLS) is an adaptive FIR filter algorithm which recursively finds the filter coefficients that minimize the weighted linear least-squares cost function relating to the input signals [37]. The RLS filter converges faster than NLMS, but at the expense of increased computational complexity.
It can be shown that the solution to this problem is when where λ is the forgetting factor (gives exponentially less weight to older errors), α(t) the a priori error, and P(t) is the covariance matrix. The filter setting was set according to the paper by Olivares et al, i.e. N = 10 [23].

Quasi-static sensor fusion.
This algorithm is implemented and described by Favre et al [18]. The method continuously monitors each sensor's activation. When the algorithm finds a quasi-static event, it adjusts the sensor fusion so that the quaternion q is weighted in favour of the accelerometric-based orientation q acc ; otherwise, it favours the gyroscopic-based orientation q gyro . The quasi-static events in time is found by looking at a(t) , ω(t) and the change in angular output between two samples A(t). The logical condition that indicates a quasi-static event is shown below, i.e. the logical expression is true when event is found: The algorithm further improves the performance by looking at the previous static event and making a linear regression between these two subsequent events to adjust the baseline between the events. The parameters are set to ε a = 0.005g, where g = 9.82 m s −2 , ε θ = π /70 rad and ε ω = π 9 −1 rad s −1 .

Standardized and modified Kalman filters.
As described by Olivares et al [23], data fusion is often done using a standardized Kalman filter that is based on fusing one orientation derived from accelerometric data and one orientation derived from gyroscopic data. In this study, this filter is referred to as the 'standardized Kalman filter'. In addition, a modified Kalman filter was used for data fusion. The input to the standardized Kalman filter was q gyro and q acc as described above. The input to the modified Kalman filter was two different q, both containing accelerometric and gyroscopic data but with different weights, i.e. calculated with different parameters ε a , ε θ and ε ω . The parameters were set according to block 3, figure 2, i.e. {ε a = 0.005g OR ε a = 0.05g}, ε θ = π 70 −1 rad and ε ω = π 9 −1 rad s −1 . The model used by both Kalman filters (see block 3, figure 2) was set to the following: The state vector x(t) therefore became The dynamic state model was defined as dx(t )/dt = 0x(t ) + Q1, which gave a discrete state model according to The complete measurement model z k for the filters became The measurement noise R x , where x denotes each dimension in x(t), was monitored during each measurement and was used as a weighting factor to the Kalman filters. The noise level R aω,x,1 were defined as the RMS-levels of ( a(t) +1) calculated in a sliding time window of 50 samples. The noise level R aω,x,2 was set to 1. If the sensor was in a quasi-static condition, the weighting factor was equal for both R aω,x,1 and R aω,x,2 (i.e. RMS of ( a(t) +1) was close to 1), but if the sensor was moving, the filter was weighted in favour of the orientation with noise level set to R aω,x,2 . Using this approach it was possible to select the signal that was most trustworthy. For the standardized filter the choice was between: (1) one orientation based on gyroscopic data alone and (2) one orientation based on a mix of gyroscopic and accelerometric data. For the modified filter the choice was between: (1) a mix of gyroscopic and accelerometric data with high accelerometer threshold (i.e. ε a = 0.05g) and (2) a mix of gyroscope and accelerometer with low accelerometer threshold (i.e. ε a = 0.005g). 3. Segment model: rigid orthoplastic shells were placed on each thigh and shank using elastic bands. A motion sensor and four markers were placed together on each shell. The sensor on the pelvis was attached using an elastic band, and three markers were taped directly onto the sensor. The global coordinate frame of the optical reference system was oriented so that global Z pointed upward, global Y in the forward direction and global X in the medial direction (to the right side of the subject).

Calculation of segment angles
Five segments were included in this study: pelvis, right and left thigh and right and left shank (figure 3). The movements in figure 1 were used for the FC procedure, i.e. the alignment of local coordinate frames of each sensor and each marker cluster to local segment frames so that X represented flexion-extension, Y abduction/adduction and Z internal/external rotation (see figure 1). The alignment procedure and calculation are further described in the appendix. The aligned angular rotation data, calculated as described above, were transformed to segment angles using the Cardan sequence X-Y-Z; X approximates flexion/extension, Y approximates abduction/adduction and Z approximates internal/external rotation, all according to [38].

Error calculations
Accuracy and precision were calculated for all segment angles and functional tests. Accuracy was defined as the absolute mean error (|ε|), i.e. the absolute mean difference in angular output between the motion sensor system and the reference system. Precision was defined as the standard deviation of the mean error (σ ε ). Bland-Altman plots were constructed to investigate systematic error effects. Figure 4 illustrates typical examples of original recordings collected from one subject during the five functional tests (i.e. gait, repetitive abduction and flexion/extension, two leg squat and one leg standing). The different curves in the figure correspond to different adaptive filters (i.e. modified and standardized Kalman filter, quasi-static algorithm, NLMS and RLS). In addition, the reference system (i.e. marker) is plotted in bold in the same figure. The results illustrates that modified Kalman and the quasi-static sensor fusion were close to the data from the reference system, while standardized Kalman, NLMS and RLS algorithms showed larger systematic errors. Mean errors were overall small, with grand mean errors of −1.2 • to 0.5 • for X (flexion/extension) and Y (abduction/adduction) angles, and errors of −1.0 • to −1.2 • for Z (external/internal rotation) angles (see table 2). This is also illustrated in figure 5, which shows that average accuracy and precision (|ε| and σ ε ) were ∼2-3 • for all algorithms. The accuracy was in general slightly worse for external/internal rotation, and modified Kalman and quasi-static sensor fusion appeared as the most accurate algorithms ( figure 5(a)). Kalman and quasi-static sensor fusion filters had the highest precision ( figure 5(b)), possibly with a slightly higher precision for external/internal rotations for the Kalman filter. Based on these results, we chose to proceed with the modified Kalman filter in all following analyses.

Results
The next step was to study the accuracy and precision for different segments during each functional test, based on the modified Kalman filter. This study assumed that each segment type (e.g. thigh and shank) has similar properties when it comes to studying normal movement characteristics. As a consequence, the results from the right and left thighs were pooled together. The same procedure was repeated for the right and left shanks. As seen in figure 6, the accuracy was overall high for the pelvis (below 2 • ) except for internal/external rotation during the one leg standing, where it was ∼7 • . The angular calculations for the shank segment showed slightly lower accuracy than for thigh and pelvis, especially during maximal hip abduction and gait. The precision was also generally lower for the shank ( figure 7). All results showed that inward/outward rotation angles were most sensitive to systematic errors and had a proportional bias, as illustrated in the Bland-Altman plot in figure 8. The confidence limit for rotation around X (flexion/extension) and around Y (abduction/adduction) was approximately ± 5 • whereas the confidence limit for rotation around Z (inward/outward) was approximately ± 13 • .

Discussion
A portable movement measurement system has great potential as a decision support system to be used in a clinical setting.  Table 2. Mean error (averaged over all segments) and standard deviation (given in parentheses) when comparing the portable system with the reference system for different adaptive filtering techniques and different functional tests. The grand mean for all functional tests is also presented.

Modified Kalman
Quasi-static sensor fusion NLMS  The distribution of mean standard deviation, mean (σ εi ). Both ε and σ are derived from the residual between the reference system's and the portable system's Euler angle around X, Y and Z. Each boxplot is based on 75 samples retrieved from the five test subjects (i.e. 3 segments × 5 subjects × 5 movement types).  Our study shows high accuracy and precision of the portable system for a set of common functional tests. In general, measurements of inward/outward rotation were most sensitive to measurement errors. The reason is that when the subject is standing, this rotation axis is aligned with the gravity axis where drift cannot be reduced. Still, accuracy and precision were still relatively high even for inward/outward rotation for most tests (figures 6 and 7). The precision of the measurement could have been maximized further by lowering the cut-off frequency of the low-pass filter in blocks 1 and 2, figure 2. However, this will affect the appearance of the movement patterns since there are natural frequency components below 10 Hz. Accuracy and precision for angular measurements of the shank were in general slightly worse than for pelvis and thigh. An explanation for this finding could be that shank moves more than pelvis and thigh during many of the performed tests in this study. Therefore, the X or Y axis of the shank is more often momentarily aligned with the gravity axis, hence leading to more drift in the segment angles around these axes. Still, considering the small magnitude of errors, we suggest that the motion sensor system is suitable for kinematic analysis of the lower body for, e.g., gait analysis and range of motion measurements. For balance tests (in this study one leg standing) or other standing tests that are measured over longer time periods (1 min or longer), the system is suitable for measuring flexion-extension and abduction-adduction angles.
In contrast, inward/outward rotation should be excluded, due to systematic drift ( figure 8). However, this type of drift can be handled if a magnetometer is added.
Olivares et al compared different algorithms on synthesized and real signals and found RLS to be the most robust algorithm under both low-and high-intensity conditions [23]. In contrast, the Kalman filter used in their study did not converge to the proper solution. We got similar results in this study when using the standardized Kalman filter (figure 4). The explanation for this finding is that the gyroscopic signal drift is only compensated during quasi-static conditions. This problem was handled with the modified Kalman filter, which leads to much better performance ( figure 4).
For clinical purposes, measurements of lower body segment and joint angles must of course be reliable, but it is also important that the measurements are as simple to perform as possible. The FC procedure used in this study is relative straightforward to use. A drawback is that the quality of the FC procedure is sensitive to how the movements are performed [39]. Hence if the movement is not performed correctly, the local coordinate system may be displaced, giving false magnitudes in X, Y and Z angles. To improve the calibration performance further, the calibration movements could be done using passive rotation, aided by the test leader.   Figure 8. Bland-Altman plots for segment angles. Data from motion sensors using the modified Kalman filter are compared to data from the optical reference system. The Bland-Altman plots analyse the agreement between two different methods (in this case between the reference system and the portable system using Kalman filtering). The X-axis is the Euler angle measured by the reference system and the Y-axis is the difference in Euler angle between the reference system and the portable system. As can be noted, there was neither systematic nor proportional bias in Euler X and Euler Y. In Euler Z there were both systematic effects and proportional bias. The confidence limit for Euler X and Euler Y was approximately ± 5 • , whereas the confidence limit for rotation around Z was approximately ± 13 • .

Conclusions
The aims of this study were to compare adaptive filtering techniques used for sensor fusion and to evaluate the precision and accuracy for a chosen adaptive filter. In this study, the following adaptive filters were tested: (1) a modified Kalman filter, (2) a quasi-static sensor fusion algorithm, (3) a normalized least mean square filter, (4) a recursive leastsquares filter, and (5) a standardized Kalman filter. The precision and accuracy were overall good compared to the reference optical system during the standardized tests. The quasi-static sensor fusion and the modified Kalman filter gave the best performance, with a precision and accuracy of ∼2-3 • . The modified Kalman filter gave satisfying results for all segments and clinical tests used in this study, even though some differences were observed; e.g. shank showed slightly higher errors than pelvis, and for one leg standing measurements or other long-term measurements done in standing postures, the drift in internal/external rotation angle must be considered [40]. Our suggestion is therefore to use either the modified Kalman filter proposed in this study, or the quasi-static sensor fusion filter, which gave similar results. Hopefully in the near future, the use of portable systems as described in this study in conjunction with adaptive filtering will facilitate the clinical use of instrumental movement analysis and thereby lead to more objective and robust analysis of clinical outcomes (e.g. the effect of different rehabilitation schemes). In future studies, further efforts should be made to make the portable systems even more robust. This will lead to more accurate long-term measurements of human movement patterns. Also, the parameters used for filter settings (e.g., Q and R mentioned above) should be optimized using some optimization algorithm (e.g. the simplex algorithm). hip abduction (see figure 1). The initial local direction cosine matrix DCM(:,:,1) was set as the orientation of each motion sensor relative to the gravitation axis defined by gravitation vector +Z Global . Y * was set as HA meanY / HA meanY . X was set as Y * × Z Global / Y * × Z Global . To ensure linearly independent coordinate axes, Y was set to Z × X/ Z × X . This gave the alignment matrix M shank = [X, Y, Z].
An alignment matrix M thigh was computed the same way as for the shank. where i = measurement frame number i.
A.1.2. Joint coordinate system. The mean helical axis direction vectors (HA meanXknee and HA meanYknee ) were calculated for the shank segment during knee extension and knee abduction (see figure 1). Note that the corrected DCM * shank was used for this step. To obtain a joint coordinate system for shank and thigh, Z was set to (HA meanXknee × HA meanYknee )/ HA meanXknee × HA meanYknee . Y was set to (Z × HA meanXknee )/ Z × HA meanXknee to ensure linearly independent coordinate axes. This gave the alignment matrix where i = measurement frame number i. These aligned DCMs were used for all following angular calculations.
A.1.3. Pelvis. The mean helical axis direction vector HA meanX was calculated for the pelvis segment during upper body flexion (see figure 1). The initial local direction cosine matrix DCM(:,:,1) was set as the orientation of each motion sensor relative to the gravitation axis defined by gravitation vector +Z Global . X * was set as HA meanX / HA meanX . Y was set as (Z Global × X * )/ Z Global × X * . In order to ensure linearly independent coordinate axes, X was set to (Y × Z)/ Y × Z . This gave the alignment matrix M shank = [X, Y, Z]. DCMs were updated with M according to DCM * pelvis,i =M pelvis · DCM pelvis,i , where i = measurement frame number i.