The phase of an electron wave, which has traveled through a magnetic sample, is modified by the magnetic and electrostatic potentials of the material. The ability to reconstruct this phase is a powerful method for quantitatively studying the magnetic structure of the sample. Recently, the ``transport-of-intensity'' equation (TIE) has been applied to phase reconstruction using Lorentz transmission electron microscopy (LTEM) data. For magnetic analyses, it is important to separate the influence of the electrostatic potential on the electron wave. In this paper, an energy-dependent TIE analysis is presented in order to differentiate the magnetic and electrostatic contributions. This approach is developed using ${\mathrm{Ni}}_{81}{\mathrm{Fe}}_{19}$ and Co patterned films in which the contribution of the electrostatic potential is significant compared to that of the magnetic potential. A good fit to theory is obtained, showing that the contribution of the electrostatic potential to the phase is dependent on the energy of the electrons, namely the applied accelerating voltage, while that of the magnetic potential is not. The energy-dependent analysis shows that neglecting the contribution of the electrostatic potential in continuous films of constant thickness can be reasonable. For patterned materials, this methodology determines which features in Fresnel and Foucault contrast LTEM images originate from the magnetic potential and can remove the electrostatic contribution in order to enable a quantitative reconstruction of the magnetic structure. In addition, the different magnetic samples are used to explain the sensitivity limits of the TIE methodology in respect to quantitative measurements of magnetic properties.