Question: Enter the matrix B and the vector d into MATLAB. To compute projVd, we must first find an orthonormal basis for V . For this,

Enter the matrix B and the vector d into MATLAB. To compute projVd, we must first find an orthonormal basis for V. For this, we use the qr() command:
>>[Q, R]= qr(B,0)
The columns of Q form an orthonormal basis for V. Let's give them their own names:
>> x = Q(:,1)
>> y = Q(:,2)
Now we're ready to compute projVd. To do this, we add up the projections of d onto each element in our orthonormal basis, like so:
>> v = dot(x,d)*x + dot(y,d)*y
The resulting vector v here is projVd. Remember to include all your input and output for this procedure in your write-up.
Now solve the equation Bc = projVd = v by typing in the following:
>> c = B\v
Check that your answer is correct by entering
>> B*c - v
Make sure the answer is zero. (Keep in mind that MATLAB may return a very small number instead of zero due to rounding errors.)
Now let's compare the answer we just found to what MATLAB gives us when we run the built-in least squares algorithm named lscov. To use it, we must specify three parameters: the matrix B, the vector d, and a covariance matrix X, which we won't worry about in this course. Type in the following command:
>> cl = lscov(B, d, eye(5))
How does your answer to this part compare to your previous answer?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!