CE 506 Homework 3 Adjustments

1. given the following data

x  |  y
-------
0  | 4.0
1  | 2.0
2  | 1.0
4  | 2.0
5  | 5.0

fit this data, via least squares, to a parabola of 
the form y = a0 + a1*x + a2*x^2. do it by observations
only with lagrange multipliers. x's are constant, y's are
observations. assume equal weights. hint for generating the
condition equations, 4 points on this parabola must
satisfy the determinant equation,

| y1  x1^2  x1  1 |
| y2  x2^2  x2  1 | = 0
| y3  x3^2  x3  1 |
| y4  x4^2  x4  1 |

2. solve the problem stated above in 1, with the following 
changes,

  (a) use the method of indirect observations
  (b) use weights 3,2,1,2,3 for y1,y2,y3,y4,y5 respectively

3. given data

x  |  y  |  z
-------------
 1 |  1  | 3.0
 1 | -1  | 2.0
-1 |  1  | 1.5
-1 | -1  | 1.2
 2 |  1  | 2.8

find by least squares the best fit plane with model
z = a0 + a1*x + a2*y. x and y are constants, z is
observation. use the method of indirect observations

-------------------------------------------------------

further hint for number 1,
if you enter into matlab the matrix

    | x1^2  x1  1 |
A = | x2^2  x2  1 | 
    | x3^2  x3  1 |
    | x4^2  x4  1 |

the following code snippet "should" generate coefficients for
the condition equations, you should confirm that they are
correct

c=zeros(1,4);
j=1;
for i=1:4
  Ap=A;
  Ap(i,:)=[];   % delete a row for determinant evaluation
  c(i)=(-1)^(i+j) * det(Ap);
  end