  Whitham theory of modulations is developed for periodic waves described by
nonlinear wave equations integrable by the inverse scattering transform method
associated with $2\times2$ matrix or second order scalar spectral problems. The
theory is illustrated by derivation of the Whitham equations for perturbed
Korteweg-de Vries equation and nonlinear Schr\"odinger equation with linear
damping.
