The resonance phenomenon in thermal waves