Confined quantum systems can present anomalous behaviour. In particular, thermodynamic properties such as specific heat can show special features when the system is subject to spatial confinement described, for instance, by a harmonic potential. The energy eigenvalues of this confined system can be obtained from a variational approach by using, as trial functions, the solution of a particle in a box multiplied by a gaussian. For a strong confinement regime, the energy eigenvalues converge to the same values of the particle in the box and, for a weak confinement regime, the energy eigenvalues converge to the free harmonic oscillator. This behaviour reflects in the thermodynamics properties. In the curves of specific heat as a function of temperature, for instance, it is possible to identify two regions, one when the contribution of the harmonic oscillator is dominant and the other one where the contribution of the particle in a box becomes more relevant. These results indicate a phase transition of second-order close to the Einstein temperature.