Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CMPSC/Mathematics 456 MATLAB Assignment One Due 10 February 2017 Spring 2014 You are to write a MATLAB function to implement to estimate the condition number
CMPSC/Mathematics 456 MATLAB Assignment One Due 10 February 2017 Spring 2014 You are to write a MATLAB function to implement to estimate the condition number of the square matrix A in the two-norm using the symmetric power iteration. Your function should have the form [cond est,u1,v1,u2,v2]=cond2(L,U,A). where L and U are the out- put from the from the command [L,U]=lu(A) which does Gaussian elimination with partial pivoting. The value cond est is your estimate for the value 2 (A) = kA1 k2 kAk2 . Thus, you will have to estimate both kA1 k2 and kAk2 using the power method. The vectors u1,v1, u2 and v2 satisfy ku1k2 = kv1k2 = ku2k2 = kv2k2 , kAv1k2 kAk2 , kAT u1k2 kAk2 , kA1 v2k2 kA1 k2 , kAT u2k2 kAT k2 . These four vectors should emerge out of the power method for approximating kAk2 and kA1 k2 . To find kAk2 you are implicitly performing the power method on AT A, to find kA1 k2 you are doing the same for (AT A)1 = A1 AT . To estimate kAk2 , you should perform k power iterations to produce (k) , u1 and v1 such that A v1 = (k) u1 and either | (k) (k1) | (1e 3) (k) 1 or kA0 u1 (k) v1k2 (1e 3) (k) or k = 10. To estimate kA1 k2 , you should perform ` power iterations to produce (`) , u2 and v2 such that A1 v2 = (`) u2 and either | (`) (`1) | (1e 3) (`) or kAT u2 (`) v1k2 (1e 3) (`) or ` = 10. Your estimate of the condition number is thus, cond est = (`) (k) . Our course, you can get away with storing only the two most recent values of (k) and (`) . In order to implement this method, you will need four matrix operations with A. 1. A v for a vector v. this is just implmented as is in MATLAB. 2. AT u for a vector u.this is just A0 u in MATLAB. 3. A1 v for a vector v 4. AT u for a vector u. To do the last two operations above, use the results from lu, namely a factorization of A into A = LU where L is a permutation of a lower triangular matrix and U is an upper triangular matrix. Remember that y = A1 v may be computed from w=L\\v y=U\\w and z = AT u may be computed from 2 w=U'\\u z=L'\\w Under no circumstances should you call the MATLAB functions inv or cond in your code! That is, do not explicitly compute the inverse, that defeats the entire purpose of this exercise! Also do not put the lines in your code y=A\\v z=A'\\u anywhere. For the same reasons! Test your routine with the matrices generated by the m-files matrix1.m, matrix2.m, matrix3.m posted in Canvas the MATLAB codes folder on the files page. Your code should be short. It is likely you will not reach the maximum number of iterations. Turn in your code and your results as a file upload on Canvas. 3 A=randn(15,15)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started