Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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)
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 equationsStep 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