Question: 2. SOR in Matlab (a). Write a Matlab function which solves a system of linear equations Az = b, with successive over relaxation (SOR) iterations.

 2. SOR in Matlab (a). Write a Matlab function which solvesa system of linear equations Az = b, with successive over relaxation

2. SOR in Matlab (a). Write a Matlab function which solves a system of linear equations Az = b, with successive over relaxation (SOR) iterations. Assume here that A is a banded matrix with band width d, (so that aij = 0 fr li-jl > d). The inputs of the function are: A, b, a starting vector zo, the band-width d, the relaxation parameter w, an error tolerance and the maximum number of iterations. The iteration stops when the error (you may use the residual r = Ar-b measured in certain norm) is less than the tolerance, or when the maximum number of iterations is reached. The function should return the solutiorn vector and the number of iterations. The first few lines in the function should look like this: tunction x.nit-sor(A.b.mo.u.d.tol,max) function [x , nit] =s or (A , b , xo,w,d,tol,max) % SOR : solve linear system with SOR iteration % Usage: [x , nitJ=sor (A,b , xo,omega , d , tol,nmax) % Inputs A an n x n-matrix, b : the rhs vector, with length n x0the start vector for the iteration

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 Databases Questions!