Question: MATLAB's qr command, which we introduced in Exercise 3.2.49, can also be used to compute QR decompositions of non-square matricies. Please answer part (b) of
MATLAB's qr command, which we introduced in Exercise 3.2.49, can also be used to compute QR decompositions of non-square matricies. Please answer part (b) of Exercise 3.3.10.


Exercise 3.3.10 MATLAB's qr command, which we introduced in Exercise 3.2.49, can also be used to compute QR decompositions of non-square matrices. (a) Try out the following commands, for example. n = 6 m = 3 A = randn (n, m) [Q,R] = gr (A) Q' *Q norm (eye (m) -Q'*Q) norm (A-Q*R) In the interest of convenience, MATLAB returns Q in assembled form. (b) Write a short MATLAB script (m-file) that solves least squares problems using the qr command. (The submatrix R can be accessed by writing R (1:m, 1:m) or R (1:m, :), for example.) Use your script to solve the least squares prob- lems in parts (a) and (b) of Exercise 3.3.9. This is not the simplest way to solve least squares problems using MATLAB. Recall from Exercise 3.1.5 that the command x = A\b works as well. This gives you a simple way to check your work. Exercise 3.3.10 MATLAB's qr command, which we introduced in Exercise 3.2.49, can also be used to compute QR decompositions of non-square matrices. (a) Try out the following commands, for example. n = 6 m = 3 A = randn (n, m) [Q,R] = gr (A) Q' *Q norm (eye (m) -Q'*Q) norm (A-Q*R) In the interest of convenience, MATLAB returns Q in assembled form. (b) Write a short MATLAB script (m-file) that solves least squares problems using the qr command. (The submatrix R can be accessed by writing R (1:m, 1:m) or R (1:m, :), for example.) Use your script to solve the least squares prob- lems in parts (a) and (b) of Exercise 3.3.9. This is not the simplest way to solve least squares problems using MATLAB. Recall from Exercise 3.1.5 that the command x = A\b works as well. This gives you a simple way to check your work
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
