Measurement of the Q(2) and energy dependence of diffractive interactions at HERA