Question: please include matlab code if needed and label part i ii and iii thanks Problem 2 Least squares solution and round-off errors (25 points) 1
please include matlab code if needed and labelProblem 2 Least squares solution and round-off errors (25 points) 1 1 Let k be any positive integer, and A 10- 0 -10-6 1 + 10-4 1 - 10- 0 10-4 Write a MATLAB code YourlastnameyourfirstnameHW6p2.m that for each k = 5,6,7,8, com- putes the least squares solution for the above A, B, in three different ways: (i) analytically solve the normal equation by hand and hard code that analytical solution xhat-analytical, (ii) xhat.QR that numerically solves the normal equation using QR decomposition, (iii) xhat-normal that numerically solves the normal equation as a square linear system. In other words, your code should output 3 different least squares solutions for each k, where the integer k increments in a for loop from 5 to 8. For computing the analytical solution in part (i), you may use the formula for the inverse of a 2 x 2 matrix d ad - bc Please also submit a file YourlastnameyourfirstnameHw6p2.pdf showing all the steps in your hand calculations for part (i). ( (1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
