A5 - Math 235 Assignment 5 Due Wednesday Due Oct 27th 1 On...

This preview shows pages 1–4. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Math 235 Assignment 5 Due: Wednesday, Due Oct 27th 1. On M(2, 2) deﬁne the inner product < A, B >2 tr(BTA) and let s=spanua ﬁll? all: all}. a) Use the Gram-Schmidt procedure to produce an orthonormal basis for S. 0 2 b) Consider A z ["1 2 I Find the matrix B in S such that “A —~ B is minimized. 2. Determine the orthogonal compliment of the subspace S = Span {3:2 + 1} of P2 under the inner product (29,11) = p(-1)q(-1) + p(0)q(0) + p(1)q(1). 3. Find b and c to obtain the best ﬁtting equation of the form y 2 ba: + of for the following data: x —~1 0 1 1 1 4. Let V be a’ﬁnite-dimensional real inner product space with inner product Let L : V —> R be a linear map. Show that there exists a vector 21' E V such that L(f) : (f, 21‘) for all f E V. Use MATLAB to complete the following questions. You do not need to submit a printout of your work. Simply use MATLAB to solve the problems, and submit written answers to the questions along with the rest of your assignment. For questions that involve a set of vectors, enter each vector separately, giving it a name (e.g., s1, 52, s3) and then construct any required matrices from these vectors (e.g., A 2 [s1 52 33]). This will make it easier for you to work with the various elements. ——-———_________.________________ Part I: Finding an Orthonormal Basis We could use MATLAB to help complete the steps/calculations of the Gram-Schmidt process which would certainly make things faster and easier (and avoid errors), however, there is an even better way to ﬁnd an orthonormal basis using MATLAB! The orth command returns an orthonormal basis for the range (i.e., column space) of a matrix. 3 —5 1 For example, an orthonormal basis for the column space of the matrix A = _i i _; 3 —7 8 can be found as follows: >>A >>N [3 -5'1; 1 1 1; -1 5 -2; 3 -7 8] orth(A) II The columns of the matrix N are the orthonormal basis vectors. ———-——————.——.—__—___ Question 1 r (a) Use the orth command to ﬁnd an orthonormal basis for the column space of 6 —8 —7 —7 3 8 —4 9 —-1 —~9 A = —7 1 9 8 7 8 9 0 6 8 3 9 6 9 3 What is the basis that you found? (b) Verify that the basis you found is orthonormal. What command did you use to verify this? How do you know that the basis is orthonormal? Part II: Least Squares Review Section 7—3 in the textbook before attempting this question. In particular, review Example 12 on pp. 429—430, which ﬁnds the least—squares curve, y = a + bt + 0152, that best ﬁts the data 15 1.0 2.1 3.1 4.0 4.9 6.0 y 6.1 12.6 21.1 30.2 40.9 55.5 To solve this example using MATLAB, complete the following steps: 1. First, plot the data points: >> x = [1.0; 2.1; 3.1; 4.0; 4.9; 6.0] >> y = [6.1; 12.6; 21.1; 30.2; 40.9; 55.5] >> plot(x, y, ’*’); 2. Then, create the design matrix, X, for the given model: >> X = [ones(6,1) x x.“2] (Use the . “ operator for element—by—element exponentiation.) 3. If X TX is invertible, then we can quickly ﬁnd the least squares solution, ,6, using the formula ,6 = (X TX )"1X Ty. We can use the rref command to check whether or not X TX is invertible (and in this case it is), and so we can go ahead and calculate the least—squares solution: >> rref (X’*X) >> beta = inv(X’*X)*X’*y 4. Finally, we can plot the least—squares solution on the same graph as our data points to see how well the model fits the data: >> x_ra11ge = [0: 0.1: 7]’; >> y_fit_line = beta(1,1) + beta(2,1)*x_range + beta(3,1)*x_range.‘2; >> hold on '>'> plot(x_ra11ge, y_fit_line, ’r-’) Question 2 A corporation tracks its costs as a function of its sales and obtains the following data: sales (millions) u costs (millions) 4.77 16.47 Since ﬁxed costs are not included in the above data, the curve that best describes this data is of the form y = [31:13 + 323:2 + 33:133. (a) Plot the data points given above. (Notice that the points do seem to be best approximated by cubic curve.) (b) Create the design matrix of this model. What matrix did you get? (c) Find the least-squares solution. What is the solution? (d) Plot the least—squares solution on the same graph as the data points from part (a). Print out this plot and attach it to your submission. ...
View Full Document

{[ snackBarMessage ]}

Page1 / 4

A5 - Math 235 Assignment 5 Due Wednesday Due Oct 27th 1 On...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online