
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 of a comet satisfies an equation of the form , where is a constant and "e" is the eccentricity of the orbit, with 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 , radians.
Solving for r gives,
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