# Successive Over-Relaxation (SoR) Method in MATLAB

0
8919

Successive Over-Relaxation Method, also known as SOR method, is popular iterative method of linear algebra to solve linear system of equations. This method is the generalization of improvement on Gauss Seidel Method. Being extrapolated from Gauss Seidel Method, this method converges the solution faster than other iterative methods.

In this tutorial, we’re going to write a program for Successive Over-Relaxation – SoR method in MATLAB, and go through its mathematical derivation and theoretical background.

## Derivation of SOR Method:

Consider the following sets of liner equations:

a11x1 + a12x2  + a13x3  + a14x4  . . .  . . . . . . . ..  . . . + a1nxn = b1

a21x1 + a22x2  + a23x3  + a24x4  . . .  . . . . . . . ..  . . . + a2nxn = b2

a31x1 + a32x2  + a33x3  + a34x4  . . .  . . . . . . . ..  . . . + a3nxn = b3

. .  . . . . .  . . . . . .  . . . . . . . .  . . . . . . . .  . . . . . . . . . . . . . . . . . . .

. .  . . . . .  . . . . . .  . . . . . . . .  . . . . . . . .  . . . . . . . . . . . . . . . . . . .

an1x1 + an2x2  + an3x3  + an4x4  . . .  . . . . . . . ..  . . . + annxn = bn

Express these equations in the form:  Ax = b

where, Now, decompose matrix A into Diagonal component matrix D, Lower triangular matrix L, and upper triangular matrix U, such that:

A = D + L + U

where, Rewrite the system linear equation as:

( D + ωL ) x = ωb – [ ωU + ( ω – 1 ) D ] x

Where, ω is the relaxation factor and ω > 1

During the iteration process, the left hand side of the equation is solved by using the previous value for x on right hand side.

The iteration equation is expressed analytically as:

x(k+1) = ( D + ωL ) -1 (ωb – [ωU  + (ω – 1 ) D ] x (k) ) = Lω (k) + c

Where, x(k) is the kth approximation for x and x(k+1) is (k+1)th approximation for x.

Taking the advantage of triangular matrix form of ( D +  ωL), the (k+1)th can be evaluated sequentially by using forward substitution. The expression obtained for x(k+1) is: ## SOR Method in MATLAB Code:

The above code for Successive Over-Relaxation method in Matlab for solving linear system of equation is a three input program. Here, matrix A, matrix B, and relaxation parameter ω are the input to the program. The user defined function in the program proceeds with input arguments A and B and gives output X.

When the program is executed in MATLAB workspace, it asks for the value of coefficient matrix A and checks if it is square matrix or not. After getting valid input for A, another input matrix B is required to be entered to the program which must be a column matrix. Finally, the relaxation parameter is given as input and solution of linear equation comes as output.

While giving input to the program, the standard MATLAB syntaxes must be obeyed. Here’s a sample output of the MATLAB program for SOR method: In this output of the Matlab program, 2x + y – z = 8, -3x – y + 2z = -11, and -2x + y +2z = -3 have been tried to be solved. But, the largest Eigen value of iterative matrix is not less than 1. As a result of which, the problem here is not suitable for SOR method.