A betatron is provided for producing pulses of accelerated electrons, particularly in an x-ray testing device, comprising at least one main field coil, one expansion coil for transferring the accelerated electrons to a target, and one electronic control system of the expansion coil for applying an expansion pulse to the expansion coil. The electronic control system of the expansion coil is designed such that the time of the expansion pulse for adjusting the final energy of the electrons is variable relative to the main field.