function A = fivept(N); % Creates five-point FD matrix on an NxN grid, with full Dirichlet % BC points included in the matrix, but eliminated from the % stencils. % Create 1D matrices v = ones(N,1); A1d = spdiags([-v,2*v,-v],-1:1,N,N); I1d = speye(N); % Create and scale 2D matrix A = kron(A1d,I1d) + kron(I1d,A1d); A = (N+1)*(N+1)*A;