# Sensor - accelerations to displacements, error

Tags:
1. Oct 14, 2014

### Maria Redericki

Hello everybody, apologies from outset for bad English.

I wonder if anyone can give me some advice regarding my problem. I have a sesnor that gives acceleration readings. I have been working hard to turn these readings into position or displacements. I tried many method but MATLAB cumptrapz was most effective. I integrated my data twice and got position

This has been quite successful but I have recently had some test data where by I know exactly the distance travelled because I was able to measure it at the time. I now see that displacement given by cumtrap is out by a small amount. How can I improve upon accuracy. I have looked at centering my velocity aound before carrying out the second integration i have also made sure of these things such as start at point where acceleration is zero and where velocity is zero but I still have some problems. Also I find to completely do these things is tricky so I have do it with some slight error. Can you advise for me some help?
Thank you

2. Oct 14, 2014

### Dr.D

What ever in the world is cumtrapz?

Just guessing that it might be a routine based on trapezoidal integration, you might us a better integration algorithm such as Simpson's rule.

3. Oct 15, 2014

### Maria Redericki

Hello Doctor, This is a algoirthm on Mathlab based upon the trapezium rule as you suggest. I think everything around simpsons rule they have on there needs function and I just have discrete data? Do you think this will solve my problem of being a little out in terms of distance it is not by much but I want to correct

4. Oct 15, 2014

### Staff: Mentor

An acceleration sensor will always give lead to some errors - a small measurement error early on leads to a constant offset in the velocity, even with an impossible perfect integration scheme.

Is the deviation between estimated and measured distance getting worse over time?

5. Oct 15, 2014

### Dr.D

Maia, it is hard to say what will correct your problem when I do not know ith certainty what is wrong.

Simpson's rule works (approximately) with both discrete and continuous data.

You can make up a test case, perhaps pure sinusoidal data, to check the calcs to see where the error is coming in.

6. Oct 15, 2014

### Maria Redericki

Well when I examine the velocity I see that I have drift and it is quadratic. This makes me think that it could be causing error in the position data but I am not sure how to rectify this.