Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Matlab project. Please help with clear code. Thank you. Least squares solution and round-off errors (25 points) 1 1 -10-k Let k be any positive
Matlab project. Please help with clear code. Thank you.
Least squares solution and round-off errors (25 points) 1 1 -10-k Let k be any positive integer, and A 10- 0 b= 1+ 10-k 0 10-k 1 - 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: -1 d (20) 1 ad - bc -C a Least squares solution and round-off errors (25 points) 1 1 -10-k Let k be any positive integer, and A 10- 0 b= 1+ 10-k 0 10-k 1 - 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: -1 d (20) 1 ad - bc -C aStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started