  We consider a neutral exciton localized on a model p-i-n junction defined in
a two-dimensional crystal: MoSe$_2$ and phosphorene, using a variational
approach to the effective mass Hamiltonian. The non-homogeneous electric field
at the junction prevents the separation of the center of mass. The variational
solution provides the exciton density in the real space and accounts for the
kinetic energy due to the exciton localization.
  For low values of the potential step across the junction, the exciton
occupies an area which is much larger than the nominal range of the junction
and the energy remains essentially insensitive to the value of the step.
Localization of the exciton within the junction area is accompanied by the
appearance of the dipole moment induced by the local electric field. The dipole
moment becomes a linear function of the potential step only when the step is
sufficiently large. In consequence, the energy dependence on the step value is
non-parabolic. We demonstrate that the exciton gets localized not exactly at
the center of the junction but on the side which is more energetically
favourable for the heavier carrier: electron or hole.
