Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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