# New to DSP and having trouble filtering data

I am trying to make program in matlab that counts the number of times the accelerometer was lifted up and down (a rep counter for exercise). Basically my phone is getting accelerometer data on all three axes and then i import this data into matlab. I have tried to filter the data using a simple filter a = [1 -0.9] b=0.1 filter(b,a,data) but that doesn't really get rid of all the high frequency noise.

Another problem i am running into is that when i apply certain filters to the data the data gets shifted so i can no longer integrate it to get velocity (my original plan was to simple filter out high frequencies and then integrate the data to get velocity and then count the number of times it crosses zero and divide by two (which would correspond to the number of times it was at a peak and trough - divided by two for number of cycles).

But the data is so noisy that when i apply a filter not only does it get shifted away from the x axis making it impossible to integrate it, it also still has noise which would give me incorrect zero-crossings.

Is there a good beginner introduction to signal processing and accelerometer data processing? What techniques should i be aware of?

If you want to try to give the data a go here is some sample data, the rep count should be 5, The data was all taken at a 50Hz sample rate. I have to put data in the comments because SE doesnt allow posting multiple links a new poster

## 1 Answer

1. You should try with implementing your own linear filter. It is not really difficult, and you will have more control about what's going on behind the scene and it will make it easier for you to tune the filter bandwidth.

2. Speaking of bandwidth, you can try to plot the frequency analysis of your data using Fourier transform, that will help you in finding a suitable cutoff frequency.

3. A linear filter implements the equations $\sum_{i=1}^n a_i y[i] = \sum_{j=1}^m b_i x[i]$. As long as you normalize the weights $(a_i), (b_i)$ to sum to 1, you should preserve the range of the data.

• The only thing that $(a_i),(b_i)$ summing to 1 gives you is that the DC gain is unity. It says absolutely nothing about the range of the output data. – Peter K. Aug 27 '13 at 15:27
• Where should i go to learn about designing my own linear filters? – user5320 Aug 27 '13 at 21:38