I have a square, at left and right edge of it; I exactly know the boundary values (Dirichlet boundary). But at top and bottom edge, I want to let the potential to float. That means I don't imply any fixed boundary value rather I want the potential to take any value depending on the source term (i.e. right hand side of the Poisson's equation) as well as on the boundaries imposed at left and right edge.
How can I do that? More specifically, How would my matrix look to do it?
[Note: When I discretize the Poisson's equation in finite difference scheme, I get the matrix equation $Au$=$h^2$$f$$-$$B$, where $B$ serves for the Dirichlet boundaries. In the figure I show how it looks when I apply Dirichlet boundary at left and right edge. Then how to put floating boundary at top and bottom edge?]