In this paper generalized MATLAB program is developed to find crossing point at potential energy boundary surface (PEBS) through a generalized mathematical approach. In direct method of power system transient stability analysis, an energy function is formulated and then an approximate stability boundary is estimated with unstable equilibrium points at the boundary or region of attraction. However for multi-machine system finding relevant UEP for a fault trajectory is a difficult step. This program is helpful to find crossing point (exit point) at energy boundary through systematic steps for a post-fault system. This PEBS crossing in terms provide critical energy, critical clearing time and stability margin for a particular fault contingency.