I have a pressure based Depth sensor. For reference, MS5837-02BA. All depth measurements I've been able to read are very accurate (±1cm)
I tried experimenting to find out the speed of the body by differentiating the measured depth value. The measurements are taken at a 40ms time period. This is the time the sensor takes for each measurement. I've used this as the rate of measurement and calculated the speed but the values are not as correct i feel.
Here are the plots for both measured and calculated variables.
All the measurements are in meters. Would like to hear what exactly I'm doing wrong, whether its the rate of measurement or something else.
Edit: accuracy ±0.1cm to ±1cm. I verified the depth measurements using a measuring tape and it was accurate down to the cm. I couldn't measure whilst the body was moving so that may a factor
Edit 2: Response to Hilmar's comment: I've gone through what you've stated and my original depth data. So i only took my raw Depth measurements this time and discarded the speed calculations my microcontroller has done. I've calculated the derivative by finding the difference between the current and previous measurement and dividing it by the sample period. $(x[i]−x[i−1])/dt$
Here are the plots again but with the sample number changed to time
As you can see the plots are similar as earlier. And about your comment on the rise at t = 2000, the rise is not instantaneous but its actually gradual over the period of 1.32s . Have a look at this pic, note that the period in question is between t=2025 and t=2058, which means its a total period of 33*0.04=1.32s .
And the change in depth is noticeable but not at a very high rate. Note that the measurement is actually in the order of 0.1m or 1 decimeter. Hence the body had moved 0.4719m in a period of 1.32s which is just 0.35 m/s which my object is capable of. Other than this i'm uncertain where exactly i've made a blunder here. Others suggest that the high frequency noise may be a cause of this but would a simple LPF solve this problem?