successive under/over relaxation

solves the linear system Au=F using successive over/under relaxation. WhereA is diagonally dominant
3.8K Downloads
Updated 14 Mar 2008

View License

This is a small and simple program to solve the linear system Au=F when A is a diagonally dominant matrix. Although the program is quite simple, I didn't find it in this page, so I decided to post it.

This program may be useful to people programing solving Partial Differential Equations via Finite Differences. This method may be more efficient than Gauss elimination for large matrices, usually found for 2D and 3D problems.

syntax

[u, it] = sor(A,F) finds the solution of the linear system applying successive
under/over relaxation technique. In this case the parameter w, the initial guess u0, the stopping criterion dtol and the maximum number of iterations
itmax are to default values: w = 1.5, u0 = F.*0+1, dtol = 1e-3, itmax = 1000.

The parameter w can theoretically take values between 0 - 2. However, the number of iterations may be reduced if is taken near 1.5. Using w = 1 will be equivalent to use Gauss-Seidel method.

u0 is the initial guess used by SOR to find the solution. The better the initial guess the faster the solution is found. However, if the matrix A is strictly diagonally dominant, the method converges to the solution no matter the initial guess (see
http://ocw.mit.edu/OcwWeb/Aeronautics-and-Astronautics/16-920JNumerical-Methods-for-Partial-Differential-EquationsSpring2003/CourseHome/index.htm
Lecture 6 "Iterative Techniques").

As stated before the matrix A should be diagonally dominant. This program DOESN'T check this property; you will just get a NaN vector or something similar as an answer.

Finally the program will stop when abs(u-ui)/abs(ui) < dtol, where u and
ui are the solution and initial guess used for a particular iteration.

Cite As

Daniel Cortes (2024). successive under/over relaxation (https://www.mathworks.com/matlabcentral/fileexchange/19206-successive-under-over-relaxation), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Linear Algebra in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0