Question: write a MATLAB function which computes the projection of b onto the Column Space of an m n matrix A. function [p, z] = proj(A,b)
write a MATLAB function which computes the projection of b onto the Column Space of an m n matrix A.
function [p, z] = proj(A,b)

![Column Space of an m n matrix A. function [p, z] =](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f6412231d4e_56166f641218a773.jpg)
![proj(A,b) In this exercise, you will write a MATLAB function [p, z]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f64122dcdbc_56266f641226f6f2.jpg)
In this exercise, you will write a MATLAB function [p, z] -proj(A,b) which computes the projection of b onto the Column Space of an mxn matrix A. Your program should allow a possibility that the columns of A are not linearly independent. In order for the algorithm to work, you will need to create a basis for Col A * *A basis can be produced with the function shrink that you should create in MATLAB Here is the code: function B = shrink(A) format compact, , pivot] rref(A); B A(: , pivot); Also, to save a space in your file, all input vectors must be row vectors and you can use a AB command transpose to make the adjustments for the outputs to be row vectors as well. Note: the MATLAB command transpose(X) is the same as X' Recall: The vector p is the orthogonal projection of a vector b Col A onto Col A, when the columns of A are linearly independent, if and only if p -Ai, where i is the least-squares solution of Ax-b, or equivalently, the unique solution of the normal equations In this exercise, you will write a MATLAB function [p, z] -proj(A,b) which computes the projection of b onto the Column Space of an mxn matrix A. Your program should allow a possibility that the columns of A are not linearly independent. In order for the algorithm to work, you will need to create a basis for Col A * *A basis can be produced with the function shrink that you should create in MATLAB Here is the code: function B = shrink(A) format compact, , pivot] rref(A); B A(: , pivot); Also, to save a space in your file, all input vectors must be row vectors and you can use a AB command transpose to make the adjustments for the outputs to be row vectors as well. Note: the MATLAB command transpose(X) is the same as X' Recall: The vector p is the orthogonal projection of a vector b Col A onto Col A, when the columns of A are linearly independent, if and only if p -Ai, where i is the least-squares solution of Ax-b, or equivalently, the unique solution of the normal equations
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
