UCI Math Matlab Code and Questions

UCI Math Matlab Code and Questions

Matlab Code and Questions

(MATLAB problem) Let A = 1 2 4 2 0 4 1 0 2 0 1 2 a) Use the MATLAB function rank to figure the rank of A. b) MATLAB’s pinv command returns the pseudoinverse of a matrix. Use piny to compute the pseudoinverse At of A. c) Use MATLAB’s svd command to find the singular values of AA and AA, and calculate AA and ATA. Using the results of problem Q1b, and Qlc to explain AA and At A. (MATLAB problemn) Run the sample_inverse_PM.m code provided. The first 3 lines construct a random matrix A with the prescribed eigenvalues given in line 2. The 4th line constructs a matrix B which shifts the eigenvalues of A by the same amount, while leaving the eigenvalues unchanged. 1 The fifth line inverts B and names the inverse C, and the remainder of the code applies the power method to the matrix C, starting from the vector of all ones. Run the code and examine it closely, then answer the following questions. a) What are the cigenvalues of B and C? Your answer should be in terms of the cigenvalues of A. b) Use reasoning, not MATLAB, to answer this question, and show your reasoning. q is a very good approximation for an eigenvector of A. What is the corresponding cigenvalue A? c) How would the answer in b) change if we replaced 0.25 with 1.5 in line 4 of the script? Explain your answer. d) After running the code with 0.25 in line 1, show how good the approximation vector q is by typing in MATLAB norm((A-1*eye (6))*q), where is the number you obtained in b). This computes the 2-norm of the vector in parentheses; if it is small, the vector q is a good approximation. 1 [Q, R]= qr(randn (6)): 2 3 diag([2.75, -1, -3, 0.5, 8, 2]): 4 5 – A = Q*D*Q’: 6 7 – B = A – 0.25*eye (6): 00 9 9 C = inv(B); 10 11 q = ones (6, 1); s = 1; 12 13 – 14 – 15 – 16 – for j-1:18 q_old = 4: q_new = C*q_old: [m, ind] max (abs (q_new)); s. Q_new (ind (1)): a q_new/s: end = 17 18 = 19 20
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and shoul

Do you need a similar assignment written for you from scratch? We have qualified writers to help you. You can rest assured of an A+ quality paper that is plagiarism free. Order now for a FREE first Assignment! Use Discount Code "FREE" for a 100% Discount!

NB: We do not resell papers. Upon ordering, we write an original paper exclusively for you.

Order New Solution