# Computing The Center Of Multiple Data Points and Infering Related Data?

Intro:

I'm building a freefall measurement device which uses multiple LEDs and analog photo senors to detect falling spheres and in turn compute the acceleration of gravity.

Problem:

The spheres will block variable amounts of light over each sensor as the bottom, middle, and top portions occlude it. I can measure this as multiple timestamped datapoints along with the value of light getting through (0-1023.) I already have a calibration routine which records the mean, standard deviation and allows for calculation of z and p values - so the values are only recorded when the p value fits less than 5% of the calibration data. This means I should see a dataset looking something like:

reading | timestamp | z-value
0 |         3 |    0.06
1 |        20 |    0.47
2 |        49 |    1.60
3 |        75 |    0.31


I know the data isn't proper by any means (I just made the numbers up,) but if you assume that the dataset for each sensor itself follows a normal distribution (possibly with a skew due to the continued acceleration throughout the set of readings) but may be shifted due to the limitations of the hardware (mainly the sample rate of the microcontroller) is there a reliable way to calculate the centerpoint (regardless of if the center was actually sampled) and in turn infer the timestamp (with the appropriate decimal, not just rounded off - treating the timestamp column as a number line which syncs with the z-value) of that centerpoint?

I was never great at statistics and the most I'm really decent with are standard deviation, z-values, p-values, and interpreting the p-values - adding extra dimensions of data like this is really difficult so any help is appreciated.

## 1 Answer

For anyone who comes across this post looking for an answer I ended up going with a port of this code using the least squares algorithm and then taking the centerpoint of the quadratic curve produced with -(B/(2A))