Question: 5. (SOR) Implement the SOR (Successive Over-relaxation Method using MATLAB. Use the stopping criterion we discussed in class. Submit your codes through MATLAB Grader. See


5. (SOR) Implement the SOR (Successive Over-relaxation Method using MATLAB. Use the stopping criterion we discussed in class. Submit your codes through MATLAB Grader. See MATLAB Grader for details. Use your codes for SOR to solve the following linear system, 1 2 2 1 1 1 3 2 2 1 5 X = Can you find a o such that the SOR method converges? Discuss your findings. 1 %%%%%%% Do not modify this part %%%%%%% 2 A=(1 2-2 3 1 1 1 4 2 2 1]; 5 b=(1 3 5]'; 6 x0=[0 0 0]'; 7 eps=1e-5; 8 9 x=sor(A,b,x0, eps ) 10 11 %%% 12 13 % This is your code for SOR 14 % Use similar structure of Jacobi method 15 function x=sor(A,b,XO, tol) 16 X=X0; 17 x1=ones (size(x0)); 18 iter=0; sigma=0.3; % this is the parameter in SOR. 20 while ? 21 ? 22 ? % how do you get the matrix sigma*D-L in MATLAB? 23 ? 24 if iter>500 25 disp('Exceeded max iterations') 26 break 27 end 28 end 29 end 30 19 31 32 end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
