I have a sensor which is capturing accelerometer data as a person walks. What I'm interested in extracting is each signal fragment when a step is taken. The Z-axis is what is used since only one axis is required to detect changes in steps. The images below illustrates a sample Z-axis gait signal (for 400 iterations).Z-axis from accelerometer during normal gait cycle

The image below illustrates the first-half of the above signal (for 200 iterations). Z-axis from accelerometer during normal gait cycle first half

The subject is initially standing still and then begins walking at ~X=30. Notice how there is an apparent pattern as the user walks. What I'm interested in using Autocorrelation to smooth the Z-axis signal using Matlab to smooth the signal (based on the image below). Unfortunately, I don't have a strong signal processing background, and I have a decent grasp of Matlab. How can I go about achieving smoothing the gait signal so I can extract steps? The literature that I'm using suggests that steps may be extracted by looking at the peaks of the smoothed signal.


Other sources have suggested the use of Hidden Markov Models to extract each of the gait cycles, but I thought about a simpler signal processing approach before I consider using something advanced. However, what would be the best strategy if I wanted to pursue this course of action?

  • 1
    $\begingroup$ How frequently is the sensor capturing its readings? These graphs look like aliasing patterns where the gait frequency and the sensor frequency are only slightly different. $\endgroup$ – whuber Nov 6 '10 at 21:21
  • $\begingroup$ Data is being sampled at 10 acceleration readings/second. $\endgroup$ – rohanbk Nov 6 '10 at 21:30
  • 5
    $\begingroup$ Ah! So the downward spikes are where a foot hits the ground and the rest is the "jiggling" in between. If that's the case, even a crummy low-pass filter should do the job. (en.wikipedia.org/wiki/Low-pass_filter ) E.g., fdesign.lowpass (mathworks.com/help/toolbox/filterdesign/ref/… ). $\endgroup$ – whuber Nov 7 '10 at 22:08
  • $\begingroup$ Thanks for the suggestion. I'll look into the use of a low-pass filter. $\endgroup$ – rohanbk Nov 9 '10 at 2:44

Since there is quite some variation in how the steps look, you could try a statistical approach. Which could, for example, be done in the following steps:

  1. Generate the feature vector. Filter the signal by a number of filters, each having a different frequency response. A set foo (haar)-wavelets might be a reasonable starting points. if your original signal has N samples, and you have K filters, this filtering should result in an N-by-K matrix. take the element-wise square to determine the energy in each of the signals.

  2. Generate ground truth. Write down the sample numbers which mark the start of each step, store them in vector S. Use this to make ground truth output data: Y = zeros(N,1); Y(S) = 1.

  3. Train your classifier. Now you can apply a generic classification algorithm (e.g. LDA or logistic regression) to the results of step 1 and 2. Matlab implementations should not be hard to find.

  4. Apply you classifier on new data. For new data, repeat step 1. this can then be used to as input for the classifier resulting from step 3. It might be necessary to post-process this data, for example by low-pass filtering it. Setting a threshold with some hysteresis should then give you the start of each step


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.