Write a MATLAB function [p, z] = proj(A,b) that computes the projection of b onto the Column...

60.1K

Verified Solution

Question

Electrical Engineering

Write a MATLAB function [p, z] =proj(A,b) that computes the projection ofb onto the Column Space of an m ×n matrix A. Your program should allow for the possibilitythat the columns of A are not linearly independent. In order forthe program to work, you will need to create a basis for Col A.

Answer & Explanation Solved by verified expert
4.2 Ratings (545 Votes)
diary onformat compactPart IV Orthogonal Projections LeastSquaresSolutions Exercise36shrink functionfunction B shrinkAformat compactB A pivotproj functionfunction p projAbformat compactA shrinkAb transposebif sizeA 1 sizetransposeb 2if rankA rankA bp transposebdisppz transposeb pdispzdispb is in the Col AquitelseR colspacesymAT 0for i 1sizeR2T T dotRibendT closetozeroroundoffTif T 0z transposebp z transposebdisppdispzdispb is orthogonal to Col Aquitelsep A transposeA A transposeAbdisppz transposeb transposepD dotp zif absD 1E7dispYes p and z are orthogonal Great JobelsedispOops Is there a bug in my codeendendendelsedispNo solution dimensions of A and b disagreep symemptyvectorreturnendExercise36 aAmagic6AA14b16A 35 1 6 263 32 7 2131 9 2 228 28 33 1730 5 34 124 36 29 13b 1 2 3 4 5 6projAb094922159929492391805128759180Yes p and z are orthogonal Great Jobans 094922159929492391805128759180Exercise36 bAmagic6Eeye6bE6A 35 1 6 26 19 243 32 7 21 23 2531 9 2 22 27 208 28 33 17 10 1530 5 34 12 14 164 36 29 13 18 11b 0 0 0 0 0    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students