Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use MATLAB to solve the following. If there are extra or optional parts, you do not need to solve them. I will give a
Please use MATLAB to solve the following. If there are extra or optional parts, you do not need to solve them. I will give a good rating for code that is correct or only has minor mistakes. Thanks!
Note: This problem uses the same setup as the Jacobi and Gauss-Seidel questions, but you are asked to calculate different values. It will probably be useful to copy code from those problems, but make sure that you alter your final answers accordingly. Any matrix A can be composed into a diagonal, upper and lower part: 0 420 0 0 0 0 0 0 0 0 D=1 0 0 0 0 1.0 = and L = 0 0 0 1 0 lo 0 . 0 so that A = D +U+L. You can easily find these matrices in Matlab with the commands diag, triu and tril. These matrices are useful for devising different matrix splitting methods. For instance, in the Jacobi method we let A = P+T where P = D and T = U + L. and in the Gauss-Seidel method we set P=D+L and T = U. Another common matrix splitting method is called successive over-relaxation (SOR). It is exactly the same as the splitting methods we have already seen, except we set P=1D+L and T =W-1D+U. where is a constant between 1 and 2. (Notice that if w = 1 then this is exactly the same as Gauss-Seidel.) We will use this method to solve the system A p that was described in the Jacobi and Gauss-Seidel problems. As a reminder the setup for those problems is included at the bottom of this page. I have not included pretests for A, rho or phi in this problem, since you already know how to define them. Instead, you should define the matrices D. U and L for this problem and save them in variables named D. U and L. For any given a), the SOR method can be written as = M -1 +. For a = 1.6, find the largest in magnitude) eigenvalue of M and save its magnitude in a variable named ans1 (Remember that you can find the magnitude of a number in Matlab with the abs command. Your answer should be a positive real number.) For every value of between 1 and a = 1.99 in increments of 0.01, find the largest in magnitude) eigenvalue of M. Find the value of that gives you the smallest maximum eigenvalue and save this w in a variable named ans2. (That is, find the value of o for which this matrix splitting method will converge the fastest.) Use SOR to solve for with the optimal you found in ans2. Your initial guess should be a vector of all 1's and you should stop when - illo 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