We examine the dynamics of a one-dimensional harmonically trapped Bose–Einstein condensate (BEC), induced by the addition of a dimple trap whose depth oscillates with time. For this purpose, the Lagrangian variational method (LVM) is applied to provide the required analytical equations. The goal is to provide an analytical explanation for the quasiperiodic oscillations of the BEC size at resonance, that is additional to the one given by Adhikari (J Phys B At Mol Opt Phys 36:1109, 2003). It is shown that LVM is able to reproduce instabilities in the dynamics along the same lines outlined by Lellouch et al. (Phys Rev X 7:021015, 2017). Moreover, it is found that at resonance the energy dynamics display ordered oscillations, whereas at off-resonance they tend to be chaotic. Further, by using the Poincare–Lindstedt method to solve the LVM equation of motion, the resulting solution is able to reproduce the quasiperiodic oscillations of the BEC.