No energy is lost during SHM. In reality, energy is dissipated---this is known as damping. Damped harmonic motion arises when energy loss is included.
A natural model for damping is to assume that the resistive force is opposite and proportional to the velocity. Then the equation of motion is:
∑ F = - k x - b v = m a
Writing v and a in terms of time derivatives of the displacement, the equation of motion is:
The solution to this equation is:
x(t) = A e-bt/2m
There are 4 different behaviors that depend on the damping constant b:
In the underdamped regime, the energy decays exponentially in time:
E(t) = ½ k x2max = ½ k A e-bt/m ≡ E0 e-t/τ
where τ is the time constant of the damping.