Question: Please write out the code so it is pastable! Thank you! 2. SOR in Matlab (a). Write a Matlab function which solves a system of

 Please write out the code so it is pastable! Thank you!2. SOR in Matlab (a). Write a Matlab function which solves a

Please write out the code so it is pastable! Thank you!

2. SOR in Matlab (a). Write a Matlab function which solves a system of linear equations Arb, with successive over relaxation (SOR) iterations. Assume here that A is a banded matrix with band width d, (so that aij 0 for li-jl > d). The inputs of the function are: A, b, a starting vector Fo, 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 rAr-b measured in certain norm) is less than the tolerance, or when the maximum number of iterations is reached. The function should return the solution vector r and the number of iterations. The first few lines in the function should look like this: function [x,nit]-sor (A, b, x0, w,d,tol,nmax) % SOR : solve linear system with SOR iteration % Usage : [x , nit1-sor(A,b,x0 , omega,d,tol.max) % Inputs: A : an n x n-matrix, b the rhs vector, with length in x0 the 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!