Question: Please use the MATLAB code provided below!!! Thank You!! MATLAB Code for SOR method: function x=SOR(A,b,omega,x0,options) %A-- a nXn matrix %b-- a nX1 vector %x--

Please use the MATLAB code provided below!!! Thank You!!

Please use the MATLAB code provided below!!! Thank You!! MATLAB Code forSOR method: function x=SOR(A,b,omega,x0,options) %A-- a nXn matrix %b-- a nX1 vector

MATLAB Code for SOR method:

function x=SOR(A,b,omega,x0,options) %A-- a nXn matrix %b-- a nX1 vector %x-- a solution of Ax=b D=diag(A); L=tril(A)-diag(D); U=triu(A)-diag(D); CurIter=0; n=size(A,1); x=x0; while 1 for i=1:n x(i)=omega*(b(i)-L(i,:)*x-U(i,:)*x0)/D(i)... +(1-omega)*x0(i); end CurIter=CurIter+1; disp([num2str(CurIter) '-th: Residual is ' num2str(norm(A*x-b))]) if CurIter>options.MaxIter break end if norm(x-x0) 10 1 1 -10 1 3. Solve 30-0-- @)-( 3) . 1 1 10 X1 X2 x0 = 0 X3 # of iterations for SOR method Stopping tolerance w = 1.1 0 = 1.4 W = = 1.6 0 = 1.9 10-5 10-10 10 1 1 -10 1 3. Solve 30-0-- @)-( 3) . 1 1 10 X1 X2 x0 = 0 X3 # of iterations for SOR method Stopping tolerance w = 1.1 0 = 1.4 W = = 1.6 0 = 1.9 10-5 10-10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!