
Least squares fitting
Hi
Having some problems with setting this one up.
According to Keplerīs first law, a comet should have an elliptic, parabolic or hyperbolic orbit(with gravitational attractions from planets ignored). In suitable polar coordinates, the position $\displaystyle (r,\phi) $ of a comet satisfies an equation of the form $\displaystyle r = \beta +e(r\cdot cos(\phi)) $ , where $\displaystyle \beta $ is a constant and "e" is the eccentricity of the orbit, with $\displaystyle 0 \leq e < 1 $ for an ellipse, e=1 for a parabola and e > 1 for a hyperbola.
Given the data below, determine the type of orbit, and predict where the comet will be when $\displaystyle \phi = 4.6 $ , radians.
$\displaystyle \left[ \begin{matrix} \phi & 0.88 & 1.1 & 1.42 & 1.77 & 2.14 \\ r & 3.00 & 2.30 & 1.65 & 1.25 & 1.01 \end{matrix} \right] $
Solving for r gives, $\displaystyle r = \frac{\beta}{(1e\cdot cos(\phi))} $
How would I set a design matrix up?

Hi Twig,
the line of best fit is r = beta + e(r cos phi)
That suggests you define x_i = r cos phi and y_i = r (i=1,..,5).
The formulae for least squares are this:
beta = (sum x_i y_i times sum x_i  sum y_i times sum x_i^2) / ((sum x_i)^2  n sum x_i^2)  here n = 5
e = (sum y_i  n beta) / sum x_i
I get
beta = 1.451 and e = 0.811 (i.e. elliptic)
If phi = 4.6, then your formula for r yields r = 1.33.
Best
ZD