12.07.2015 Views

General linear least squares - UGAstro

General linear least squares - UGAstro

General linear least squares - UGAstro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

An simple example: uniform acceleration from restSuppose we have a set of data described by a parabolic relationx = 1 2 gt 2 ,e.g., the distance traveled by a body dropped from rest. How do we find the value of g? Somedata are shown in Figure 1.Figure 1: Measurement of the position of a body falling from rest under gravity with g =9.81 m s -2 . The dotted line shows the fit that you get if you fit a general quadratic.If the data vectors are t and x, in IDL the solution is implemented as follows:b = transpose([0.5*t^2])y = transpose(x)psi = invert( transpose(b) ## b)ans = psi ## transpose( b) ## yNote that the transpose function in the first two steps is to convert the row vectors intocolumn vectors. In IDL the matrix multiplication operator is ##.The conventional (but wrong) approach would be to fit a second order polynomial to the data:res = poly_fit(t,x,2)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!