Parabolic fiting for sub-sample precision I am performing cross-correlation between two double[1024] arrays. I want to track the correlation's maximum with sub-sample accuracy, so I decided to implement parabolic fitting to my code. I used this class, that seems to work well.

To make this class work I have to feed it with the points I want it to apply to. My question is simple : what are the best points to feed it ? Should I give it the maximum of the cross-correlation and it's direct neighbours ? Should I space them more ? Should I NOT feed it the maximum of the cross-correlation ? Should I limite myself to 3 points, of give it as much as I can ?

Bonus question : if you think this class is not the most suitable and know a better way to implement parabolic fitting to my code, I am open to suggestions.

Thanks.
You can use the formulas presented in the answers to: How to calculate a delay (correlation peak) between two signals with a precision smaller than the sampling period?

To recap, find the largest value, called $\beta$. Take also the values of the samples just to the left of it, $\alpha$, and just to the right of it, $\gamma$. Then calculate the peak position $p$ of Lagrange parabolic interpolation by:


  $$p = \frac{1}{2} \frac{\alpha - \gamma}{\alpha - 2\beta + \gamma}$$


If your signals are white you can get an unbiased estimate $d$ of the peak position from the biased estimate $p$ by:


  $$d = \frac{\sqrt{32p^2 + 1} - 1}{8p}$$


These estimates give the peak position relative to the position of the sample with the highest value.