 In the undulator the electrons are wiggled and emit light characteristic of the undulator strength but within a certain energy bandwidth.The emitted photons travel slightly faster than the electrons and interact with them each undulator period.Depending on the phase to each other, electrons gain or lose energy (velocity), i.e.