Solved – Using autocorrelation to find commonly occurring signal fragments

autocorrelationmarkov-processMATLABsignal processing

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.

Goal

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?

Best Answer

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

Related Question