Question: Please help me with the question that highlighted by using matlab to solve it. The last two pictures are the example of different question. Thank


1. 100 Points) Consider a system of linear equations 0 0 0 0 [-2 1 0 1 -2 1 0 1 -2 0 0 1 ... ... 0 ... 1 0 0 ... ... -2 1 1 -2 1 0 10 ... 0 1 -2 1 0 0 1 -2 79 91 : 99917 0 0 0 ... 0 0 | on stion. Solve the system by Gauss-Seidel method. Solve the system by the SOR with w = 1.7. X jacobi 1. Udubbele. Gaussselael.m Jacobi.m function x=GaussSeidel (A,b,x) n=rank (A); Rmax=Inf; tol=le-5; iter=0; Ewhile Rmax>tol x_old=x E for i=1:n sigma=0; for j=1:1-1 sigma=sigma+A(i,j) *x(j); end for j=i:n sigma=sigma+A(i,j) *x_old (j); end x(i)=x_old (i) + (b(i)-sigma)/A(i, i); R(i)=b (i)-sigma; end Rmax=max (abs (R)); iter=iter+1; end c = ['No.of Iteration=', num2str(iter)]: disp(c); end 1 1 1 JULUDI LINI TUMAMA IMA 1. mx SOR.m function x=SOR (A, b, x,w) n=rank (A); Rmax=Inf; tol=le-5; iter=0; Elwhile Rmax>tol x_oldex for i=1:n sigma=0; for j=1:1-1 sigma=sigma+A(i,j)*x(j); end o I 1 1 1 1 for j=i:n sigma=sigma+A(i,j) *x_old (j); end x(i)=x_old(i) +w* (b(i)-sigma)/A(i,i); R(i)=b (i)-sigma; end Rmax=max (abs (R)); iter=iter+1; end C = ['No.of Iteration=', num2 str(iter)); disp (c); end 1 1 1 m 1 1 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
