solns6

# solns6 - MATH 235/W08 Orthogonality Least-Squares& Best...

This preview shows pages 1–4. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MATH 235/W08: Orthogonality; Least-Squares; & Best Approximation SOLUTIONS to Assignment 6 Solutions to questions 1,2,6,8. Contents 1 Least Squares and the Normal Equations*** 2 1.1 Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Best Polynomial Fit*** 7 2.1 Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3 Least Squares Solutions and Errors 10 4 Best Quadratic Polynomial Fit 10 5 Best Approximation in Continuous Function Space 10 6 Orthogonality*** 10 6.1 Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 7 MATLAB; Best Line Fit 12 8 MATLAB; Best Quadratic Fit*** 12 8.1 Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 9 BONUS: Eigenvalues and Best Approximation 14 1 1 Least Squares and the Normal Equations*** Find the least-squares approximation and the error to a solution of A x = b , by constructing the normal equations for ˆ x and then solving for ˆ x : (a) A = 3 5- 2- 6- 5- 11 , b = 3 3 3 (b) A = - 2 i 1- 1 3 i- 1 + 2 i- 1 + 3 i , b = - 3 + i- 4 + 2 i 2 + i Note that the normal equations over C for A x = b are A * A x = A * b where the operation * denotes complex conjugation plus transposition, that is, A * = A T . (c) A = - 2- 1- 8- 6- 4 2- 3 8 1- 9- 2- 3 1- 1- 1- 4- 7 3- 7- 3- 1 1 9 8 3- 4- 2- 7- 2- 2 9 4 20- 51- 1- 23 37 7 25 56 17 48- 71- 18 17- 56 42 7- 58 4- 54- 107- 174- 50 60 84 , b = - 83- 30- 3- 67- 49 191 375- 676- 558 734 Hint: The file tempoutput.txt at http://orion.math.uwaterloo.ca/˜hwolkowi/henry/teaching/w08/235.w08/miscfiles/tempoutput.txt and MATLAB may help. 1.1 Solution BEGIN SOLUTION: (a) Following is the solution first using \ in MATLAB and then using GE. The MATLAB output follows. format compact A=[ 3 5-2-6-5-11 ]; b=[3;3;3]; disp(’construct matrix and RHS for normal equations’) construct matrix and RHS for normal equations AtA=A’*A;Atb=A’*b; disp(’solve for xhat using \’) 2 solve for xhat using \ xhat=AtA\Atb xhat = 4.0000-2.0000 disp(’the error ||A xhat -b|| is’) the error ||A xhat -b|| is norm(A*xhat-b) ans = 1.7321 disp(’solve for xhat using GE with a check col.’) solve for xhat using GE with a check col. disp(’First form the augmented matrix’) First form the augmented matrix augM=[AtA Atb ] augM = 38 82-12 82 182-36 disp(’Now add a check column’) Now add a check column augM=[augM augM*ones(3,1)] augM = 38 82-12 108 82 182-36 228 tempA=sym(augM) tempA = [ 38, 82, -12, 108] [ 82, 182, -36, 228] disp(’Now start to pivot’) Now start to pivot tempA(1,:)=tempA(1,:)/tempA(1,1) tempA =...
View Full Document

{[ snackBarMessage ]}

### Page1 / 15

solns6 - MATH 235/W08 Orthogonality Least-Squares& Best...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online