I have 3 equations
$y_1=ax_1^2+bx_1+c$,
$y_2=ax_2^2+bx_2+c$,
$y_3=ax_3^2+bx_3+c$
i.e. 3 pairs of values $x_1$,$y_1$, $x_2$,$y_2$ and $x_3$,$y_3$ and I need to fit the curve. I found lots of code for $n$ pairs using matrices but really just have this simple case of 3
I need $a,b,c$ in terms of the paired values.
There must be a simple equation?
If this is just what you need, eliminate variables one after each other. You will be left with one linear equation to solve for $c$ $$c=\frac{x_3 (y_1-y_2)+x_1 (y_2-y_3)+x_2 (y_3-y_1)}{(x_1-x_2) (x_1-x_3) (x_2-x_3)}$$ $$b=\frac{y_1-y_2}{x_1-x_2}-c (x_1+x_2)$$ $$a=y_1-bx_1-c x_1^2$$