Given a list of points $(x_1, x_2) \in \Bbb R^2$, I would like to find the ellipse that best fits the given points in the least-squares sense. I have a general function $f :\Bbb R \times \Bbb R \to \Bbb R$ of the form
$$f({\bf a}, {\bf x}) = a_0 x_1^2 + a_1 x_1 x_2 + a_2 x_2^2 + a_3 x_1 + a_4 x_2 + a_5 = {\bf a}^\top {\bf x}$$
a = ($_0$ $_1$ $_2$ $_3$ $_4$ $_5)^T$, x = ($x_1^2$ $x_1x_2$ $x_2^2$ $x_1$ $x_2$ 1)$^T$.
One of the steps is as follows. Use the equation $4_0_2 − _1^2$ = 1 as constrain and build constrain matrix $C$ so that $a^T C a = 1$.
I don't understand how to build matrix $C$. I am pretty confident it has to be a matrix of numbers. Here is the full article I use:
- M P Lawiyuniarti, E Rahmadiantri, I M Alamsyah, G Rachmaputri, Application of least-squares fitting of ellipse and hyperbola for two dimensional data [PDF], 2018.
The constraint matrix $C$ is as follows
$C = \begin{bmatrix} 0 && 0 && 2 && 0 && 0 && 0 \\ 0 && -1 && 0 && 0 && 0 && 0 \\ 2 && 0 && 0 && 0 && 0 && 0 \\ 0 && 0 &&0 && 0 && 0 && 0 \\ 0 && 0 && 0 && 0 && 0 && 0 \\ 0 && 0 && 0 && 0 && 0 && 0 \end{bmatrix} $