How to solve pentadiagonal system using Gaussian Elimination and/or Gauss Seidel

786 Views Asked by At

I'm trying to solve the 2-D Poisson Equation using both Gaussian Elimination (forward elimination and back substitution) and Gauss Seidel method.

The equation is as follows:

$\ d^2u/dx^2 + d^2u/dy^2 = F(x,y)$

After discretization and applying Dirichlet boundaries for y=start and y=end and applying Neumann boundaries for x=start and x=end I ended up with a pentadiagonal coefficient matrix and a right hand side vector that is made up of F and the boundaries (only in the first and last terms of F). The following are images of the coefficient matrix, A, and the right hand side vector F:

Coefficient Matrix A

Right Hand Side Vector F

I have solved tridiagonal systems using both Gaussian Elimination and Gauss Seidel but I cannot figure out how I would go about doing this for this new pentadiagonal system,

$\ Au=F$ .

Thanks in advance for your help!

P.S. I am writing the code in MATLAB if anyone was interested.