Description
1. The Matlab script poisson.m solves the Poisson problem on a square m × m grid with
∆x = ∆y = h, using the 5-point Laplacian. It is set up to solve a test problem for which the
exact solution is u(x, y) = exp(x + y/2), using Dirichlet boundary conditions and the right
hand side f(x, y) = 1.25 exp(x + y/2).
(a) Test this script by performing a grid refinement study to verify that it is second order
accurate. Plot the error versus mesh width and compute an estimate for the convergence
rate.
(b) Modify the script so that it works on a rectangular domain [ax, bx] × [ay, by], but still
with ∆x = ∆y = h. Verify that your computed solution agrees with the exact solution.
(c) Further modify the code to allow ∆x 6= ∆y and test the modified script. Verify that
your computed solution agrees with the exact solution.
(d) When ∆x 6= ∆y, how do you expect the error to behave? Give a brief discussion on
your reasoning.
1