Least squares fitting elliptic curve