The need to achieve high energies in particle accelerators has led to the development of new accelerator technologies, resulting in higher beam intensities and more compact devices with stronger accelerating fields. In such scenarios, beam-loading effects occur, and intensity-dependent gradient reduction affects the accelerated beam as a consequence of its interaction with the surrounding cavity. In this study, a power-diffusive partial differential equation is derived to account for this effect. Its numerical resolution has been implemented in the tracking code RF-Track, allowing the simulation of apparatuses where transient beam loading plays an important role. Finally, measurements of this effect have been carried out in the CERN Linear Electron Accelerator for Research (CLEAR) facility at CERN, finding good agreement with the RF-Track simulations.