Do the following using Matlab: Let A be a matrix where each row corresponds to an article, and each column to how often a specific word appears in the article. Patterns among the articles and words can often be identified by analyzing the singular values and vectors of the singular value decomposition of A.
(a) Use the Matlab svd function to find the singular values of the following . Note this problem does not ask you to print out the entire single value decomposition, only the singular values.
A = [9 0 3 4 0 0 0 0 0 4 1 0 0 1 3 2 1 8 0 1
8 0 3 5 0 0 1 0 0 3 1 0 0 2 3 2 1 7 0 1
0 1 0 1 2 3 4 5 3 1 0 0 0 0 0 1 1 0 2 7
7 0 3 4 0 0 1 0 0 5 1 0 0 0 2 2 1 8 1 1
0 1 2 0 2 3 4 5 2 1 0 1 0 0 0 1 1 0 2 7
9 0 4 5 0 0 1 0 0 4 1 0 1 0 2 2 0 7 0 1
0 1 0 2 4 3 5 6 3 2 0 0 0 0 0 1 0 0 2 6]
(b) Have Matlab print the ratio of the largest singular value to the smallest singular value. Also have Matlab print out the condition number of A (recall the Matlab cond(A) function returns the condition number of A).
(c) Use the Matlab svds functions with arguments A and 2 to find the singular value decomposition associated with the largest two singular values of A. For this part have Matlab return U, ?, and V matrices. (Here, U, ?, and V refer to the portion of those matrices returned by svds when the second argument is 2.)
(d) Have Matlab multiply from part (c), print the product, and then compare the result to the original A matrix by printing the norm of . In this problem, make sure you use the U, ?, and V from part (c).
For this problem, turn in a diary or script — showing both the Matlab statements used and Matlab’s output — for parts (a) through (d)).
A = [9 0 3 4 0 0 0 0 0 4 1 0 0 1 3 2 1 8 0 1;
8 0 3 5 0 0 1 0 0 3 1 0 0 2 3 2 1 7 0 1;
0 1 0 1 2 3 4 5 3 1 0 0 0 0 0 1 1 0 2 7;
7 0 3 4 0 0 1 0 0 5 1 0 0 0 2 2 1 8 1 1;
0 1 2 0 2 3 4 5 2 1 0 1 0 0 0 1 1 0 2 7;
9 0 4 5 0 0 1 0 0 4 1 0 1 0 2 2 0 7 0 1;
0 1 0 2 4 3 5 6 3 2 0 0 0 0 0 1 0 0 2 6];
%% part a
s = svd(A); % print singular values of matrix A
display(s);
% output
% s =
%
% 27.5875
% 18.8616
% 3.0180
% 2.5743
% 2.2455
% 1.4063
% 1.1891
%% part b
r = s(1)/s(end);
display(r); % print the ratio of largest to smallest singular
value
% output
% r =
%
% 23.2005
%% part c
[U,S,V] = svd(A);
% extracting 2 colm from U
u2 = U(1:end,1:2);
% extracting 2 row and 2 colm from S
s2 = S(1:2,1:2);
% extracting 2 colms from V
v2 = V(1:end,1:2);
% ans = u2, s2, v2
display(u2);
display(s2);
display(v2);
% output
% u2 =
%
% -0.5056 -0.1387
% -0.4723 -0.1026
% -0.1162 0.5537
% -0.4715 -0.0835
% -0.1203 0.5413
% -0.5013 -0.1096
% -0.1406 0.5931
% s2 =
%
% 27.5875 0
% 0 18.8616
% v2 =
%
% -0.5851 -0.1929
% -0.0137 0.0895
% -0.2390 -0.0175
% -0.3325 -0.0111
% -0.0375 0.2419
% -0.0410 0.2685
% -0.1121 0.3738
% -0.0734 0.4789
% -0.0366 0.2398
% -0.3016 0.0299
% -0.0707 -0.0230
% -0.0044 0.0287
% -0.0182 -0.0058
% -0.0526 -0.0182
% -0.1769 -0.0588
% -0.1551 0.0434
% -0.0611 0.0408
% -0.5304 -0.1729
% -0.0444 0.1746
% -0.1613 0.5720
%% part d
m = u2*s2*v2'; % calculate U*S*V' for 2 singular value
d = norm(m - A); % calculate norm of diff os U*S*V' and A
display(d); % finally print the norm
% output
% d =
%
% 3.0180
Do the following using Matlab: Let A be a matrix where each row corresponds to an...
5. Let B be the following matrix in reduced row-echelon form: 1 B= 1 -1 0-1 0 0 2 0 0 0 0 0 0 0 0 (a) (3 pts) Let C be a matrix with rref(C) = B. Find a basis of ker(C). (b) (3 pts) Find two matrices A1 and A2 so that rref(A1) = rref(A2) im(A) # im(A2). B, and 1 (c) (5 pts) Find the matrix A with the following properties: rref(A) = B, is an...
True or False? 1. If σ is a singular value of a matrix A, then σ is an eigenvalue of ATA Answer: 2. Every matrix has the same singular values as its transpose Answer: 3. A matrix has a pseudo-inverse if and only if it is not invertible. Answer: 4. If matrix A has rank k, then A has k singular values Answer:_ 5. Every matrix has a singular value decomposit ion Answer:_ 6. Every matrix has a unique singular...
Develop a function QR deceomposition using MATLAB and solve this system Develop a function qr solve that solves an n × n system using the MATLAB reduced QR decomposition, if the matrix is singular, the QR decomposition will complete with no error. Make the return values [x, resid], where resid is the residual Ax -bll2. A large residual will indicate that the matrix is singular or ill-conditioned. Apply the function to solve each system -713 L 21 3-481 「11 1...
Homework problem: Singular Value Decomposition Let A E R n 2 mn. Consider the singular value decomposition A = UEVT. Let u , un), v(1),...,v(m), and oi,... ,ar denote the columns of U, the columns of V and the non-zero entries (the singular values) of E, respectively. Show that 1. ai,.,a are the nonzero eigenvalues of AAT and ATA, v(1)... , v(m) the eigenvectors of ATA and u1)...,un) (possibly corresponding to the eigenvalue 0) are the eigenvectors of AAT are...
Let A be the matrix below. Find the singular values of A and enter them as a comma-separated list. Use these to find a singular value decomposition A= ULV. Use the square root symbol 'V' where needed to give an exact value for your answer. 10 A= -5 -2 [01] Singular values: ??? To 0 0 0 0 0 T0 0 0] A = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
Below are the results of each step in the transformation of a matrix to row reduced echelon form, using Gaussian elimination. These are the same steps involved in the decomposition PALU - 2 2 0 6 AP 1 1 2 0 0 0 2 -3 1 3 3 3 1 3 3 3 0 2 3 0 0 4 2 2 A o 2 3 0 A0 0 2 -13 0 2-1 0 0 0 -2 0 0 2 -3...
1. Find a 2x2 matrix A if for the vector v= [R], Av = [4 +38] 2. For this problem, use matrices A = La ), B=1 _Jandc=lo 9]. Suppose that the matrices A and B commute (so AB=BA) and the matrices A and C commute. Find the entries for the matrix A. 3. Find a number a so that the vectors v = [3 2 a) and w = [2a -1 3] are orthogonal (perpendicular). 4. For the vector...
(911 (1) (a) Recall that a square matrix A has an LU decomposition if we can write it as the product A = LU of a lower triangular matrix and an upper triangular matrix. Show that the matrix 0 1 21 A= 3 4 5 (6 7 9] does not have an LU decomposition 0 0 Uji U12 U13 O 1 2 Il 21 l22 0 0 U22 U23 = 3 4 5 (131 132 133 0 0 U33 6...
8. Consider the real matrix As -1 0 (a) (3 pts) Find the singular values of A. (b) (4 pts) Find a singular value decomposition of A. (c) (3 pts) Find 8. Consider the real matrix As -1 0 (a) (3 pts) Find the singular values of A. (b) (4 pts) Find a singular value decomposition of A. (c) (3 pts) Find
Can you help me with this question please? For the code, please do it on MATLAB. Thanks 7. Bonus [3+3+4pts] Before answering this question, read the Google page rank article on Pi- azza in the 'General Resources' section. The Google page rank algorithm has a lot to do with the eigenvector corresponding to the largest eigenvalue of a so-called stochastic matrix, which describes the links between websites.2 Stochastic matrices have non-negative entries and each column sums to1, and one can...