Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please post your matlab code. Thanks! Note: This problem uses the same setup as the Jacobi and Gauss-Seidel questions, but you are asked to calculate
Please post your matlab code. 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: 411 0 0 0 42 - 01 0 0...00 0 0 0 DO 2 - 0 221 0 -- 0 0 1. U = and L= 100 ...a 0 0 - 4-1 al 4,2 - 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=ID+L and T =W-1D+U, where w is a constant between 1 and 2. (Notice that if a = 1 then this is exactly the same as Gauss-Seidel.) We will use this method to solve the system A 103 =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 , the SOR method can be written as De = M01-1+c. For w= 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 w between w = 1 and w= 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 a 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 0- 1Step 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