boundary_matrix function

Boundary matrix