$$-\nabla^2u = f$$
with boundary conditions:
% Compute the load vector F = zeros(nx+1, 1); for i = 1:nx+1 F(i) = f(i*k); end matlab codes for finite element analysis m files